@Override public SortedList<T> subSet(T fromElement, T toElement) { int start = find(fromElement); int end = find(toElement); if (isSubSet() && (start < 0 || end < 0)) throw new IllegalArgumentException("This list is a subset"); if (start < 0) start = 0; if (end < 0) end = list.length; return subList(start, end); }
public synchronized SortedSet<Version> getVersions(String bsn) { SortedMap<Version, Resource> versionMap = map.get(bsn); if (versionMap == null || versionMap.isEmpty()) return SortedList.empty(); return new SortedList<>(versionMap.keySet()); }
public SortedList<T> subSet(T fromElement, T toElement) { int start = indexOf(fromElement); int end = indexOf(toElement); if (isSubSet() && (start < 0 || end < 0)) throw new IllegalArgumentException("This list is a subset"); if (start < 0) start = 0; if (end < 0) end = list.length; return subList(start, end); }
<T extends Comparable< ? >> void printMultiMap(Map<T, ? extends Collection< ? >> map) { SortedList<Object> keys = new SortedList<Object>(map.keySet()); for (Object key : keys) { String name = key.toString(); SortedList<Object> values = new SortedList<Object>(map.get(key)); String list = vertical(40, values); out.printf("%-40s %s\n", name, list); } }
ArrayList yourArrayList = new ArrayList(); // creation of instance of ArrayList SortedList yourSortedList = new SortedList(); // creation of instance of SortedList yourArrayList.size() // will access the size() method of ArrayList yourSortedList.size() // will access the size() method of SortedList
@SuppressWarnings("cast") public boolean contains(Object o) { assert type == null || type.isInstance(o); return find((T) o) >= 0; }
public synchronized SortedSet<Version> getVersions(String bsn) { SortedMap<Version, Resource> versionMap = map.get(bsn); if (versionMap == null || versionMap.isEmpty()) return SortedList.empty(); return new SortedList<>(versionMap.keySet()); }