小编acn*_*www的帖子

了解CaseInsensitiveComparator中的逻辑

任何人都可以解释以下代码String.java,特别是为什么有三个if语句(我已经标记//1,//2并且//3)?

private static class CaseInsensitiveComparator
                     implements Comparator<String>, java.io.Serializable {
// use serialVersionUID from JDK 1.2.2 for interoperability
private static final long serialVersionUID = 8575799808933029326L;

    public int compare(String s1, String s2) {
        int n1=s1.length(), n2=s2.length();
        for (int i1=0, i2=0; i1<n1 && i2<n2; i1++, i2++) {
            char c1 = s1.charAt(i1);
            char c2 = s2.charAt(i2);
            if (c1 != c2) {/////////////////////////1
                c1 = Character.toUpperCase(c1);
                c2 = Character.toUpperCase(c2);
                if (c1 != c2) {/////////////////////////2
                    c1 = …
Run Code Online (Sandbox Code Playgroud)

java string jdk1.6

25
推荐指数
4
解决办法
2761
查看次数

NestedScrollView滚动与recyclerview

RecyclerView在a中布局了一个NestedScrollView并且我想要NestedScrollView滚动RecyclerView,但这只发生在recyclerView到达结尾时,下面是我的布局代码:

<android.support.v4.widget.NestedScrollView
android:id="@+id/lists_frame"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
tools:context="com.example.niuky.design.MainActivity4"
>
    <LinearLayout
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:orientation="vertical"
   >
    <View
       android:id="@+id/header"
       android:layout_width="match_parent"
       android:layout_height="256dp"
       android:background="@color/material_blue_grey_800"
       />

   <View
       android:id="@+id/tabs"
       android:layout_width="match_parent"
       android:layout_height="?android:attr/actionBarSize"
       android:background="@color/material_blue_grey_950"
       />

  <android.support.v7.widget.RecyclerView
      android:id="@+id/recyclerview2"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:minHeight="700dp"

      />
   </LinearLayout>
</android.support.v4.widget.NestedScrollView>
Run Code Online (Sandbox Code Playgroud)

这是我的运行时视图: RecycteredView在NestedScrollView中

android scrollview android-recyclerview

11
推荐指数
1
解决办法
6553
查看次数

将Gradle mavenCentral URL更改为我的仓库

在我的国家与Gradle合作时,从maven central下载jar是一项非常及时的工作.
我想将mavenCentral改为maven-nexus:
这意味着每当我使用mavenCentral时它总是指向oschina

------编辑------
我有很多mavenCentral项目,所以我不想改变每个文件.

现在在新的脚本中我使用maven {url ...}任何简单的方法?

任何人都可以发出声音吗?
谢谢!

android gradle maven-central

8
推荐指数
2
解决办法
1万
查看次数