MountPoint implements Parcelable,
                   Comparable<MountPoint> { @Override public int compareTo(@NonNull MountPoint mountPoint) { if (storageType.equals(mountPoint.storageType)) { return mountPath.compareTo(mountPoint.mountPath); } return storageType.compareTo(mountPoint.storageType); } MountPoint(@NonNull final String mountPath,
                      @NonNull final StorageType storageType); private  MountPoint(Parcel source); @NonNull File getMountPath(); @NonNull StorageType getStorageType(); @NonNull String getStorageState(); @Override int describeContents(); @Override void writeToParcel(Parcel dest,
                              int flags); @Override int compareTo(@NonNull MountPoint mountPoint); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static final Creator<MountPoint> CREATOR; }
@Test public void testCompareTo() throws Exception { final MountPoint mountPoint1 = new MountPoint("/storage1", MountPoint.StorageType.INTERNAL); final MountPoint mountPoint2 = new MountPoint("/storage2", MountPoint.StorageType.INTERNAL); assertTrue(mountPoint1.compareTo(mountPoint2) < 0); assertTrue(mountPoint2.compareTo(mountPoint1) > 0); final MountPoint mountPoint2a = new MountPoint("/storage2", MountPoint.StorageType.INTERNAL); assertTrue(mountPoint2.compareTo(mountPoint2a) == 0); final MountPoint mountPoint3 = new MountPoint("/mnt/sdcard1", MountPoint.StorageType.EXTERNAL); assertTrue(mountPoint1.compareTo(mountPoint3) < 0); assertTrue(mountPoint3.compareTo(mountPoint1) > 0); final MountPoint mountPoint4 = new MountPoint("/another", MountPoint.StorageType.USB); assertTrue(mountPoint1.compareTo(mountPoint4) < 0); assertTrue(mountPoint4.compareTo(mountPoint1) > 0); assertTrue(mountPoint3.compareTo(mountPoint4) < 0); assertTrue(mountPoint4.compareTo(mountPoint3) > 0); }