/libcore/ojluni/src/main/java/java/util/function/ |
H A D | BinaryOperator.java | 51 * @param <T> the type of the input arguments of the comparator 52 * @param comparator a {@code Comparator} for comparing the two values 57 public static <T> BinaryOperator<T> minBy(Comparator<? super T> comparator) { argument 58 Objects.requireNonNull(comparator); 59 return (a, b) -> comparator.compare(a, b) <= 0 ? a : b; 66 * @param <T> the type of the input arguments of the comparator 67 * @param comparator a {@code Comparator} for comparing the two values 72 public static <T> BinaryOperator<T> maxBy(Comparator<? super T> comparator) { argument 73 Objects.requireNonNull(comparator); 74 return (a, b) -> comparator [all...] |
/libcore/luni/src/main/java/libcore/util/ |
H A D | CollectionUtils.java | 83 * not use {@link Object#equals}: only the comparator defines equality. 85 public static <T> void removeDuplicates(List<T> list, Comparator<? super T> comparator) { argument 86 Collections.sort(list, comparator); 89 if (comparator.compare(list.get(j - 1), list.get(i)) != 0) {
|
/libcore/luni/src/test/java/org/apache/harmony/luni/tests/java/net/ |
H A D | HttpRetryExceptionTest.java | 34 // comparator for HttpRetryException objects 35 private static final SerializableAssert comparator = new SerializableAssert() { field in class:HttpRetryExceptionTest 53 LOCATION), comparator); 61 100, LOCATION), comparator);
|
/libcore/ojluni/src/main/java/java/util/ |
H A D | SortedMap.java | 39 * interface (or be accepted by the specified comparator). Furthermore, all 41 * {@code comparator.compare(k1, k2)}) must not throw a 48 * explicit comparator is provided) must be <em>consistent with equals</em> if 68 * creates an empty sorted map sorted according to the specified comparator.</li> 115 * Returns the comparator used to order the keys in this map, or 119 * @return the comparator used to order the keys in this map, 123 Comparator<? super K> comparator(); method in interface:SortedMap 142 * cannot be compared to one another using this map's comparator 143 * (or, if the map has no comparator, using natural ordering). 170 * with this map's comparator (o [all...] |
H A D | SortedSet.java | 38 * interface (or be accepted by the specified comparator). Furthermore, all 40 * (or <tt>comparator.compare(e1, e2)</tt>) must not throw a 47 * explicit comparator is provided) must be <i>consistent with equals</i> if 64 * sorted set sorted according to the specified comparator. 3) A 110 * Returns the comparator used to order the elements in this set, 114 * @return the comparator used to order the elements in this set, 118 Comparator<? super E> comparator(); method in interface:SortedSet 138 * set's comparator (or, if the set has no comparator, using 167 * with this set's comparator (o [all...] |
H A D | Comparator.java | 45 * The ordering imposed by a comparator <tt>c</tt> on a set of elements 51 * Caution should be exercised when using a comparator capable of imposing an 53 * Suppose a sorted set (or sorted map) with an explicit comparator <tt>c</tt> 62 * to an empty {@code TreeSet} with comparator {@code c}. 72 * order for the data structure to serialize successfully, the comparator (if 76 * <i>imposed ordering</i> that a given comparator <tt>c</tt> imposes on a 92 * <p>Unlike {@code Comparable}, a comparator may optionally permit 100 * @param <T> the type of objects that may be compared by this comparator 136 * any comparator that violates this condition should clearly indicate 137 * this fact. The recommended language is "Note: this comparator 377 nullsFirst(Comparator<? super T> comparator) argument 398 nullsLast(Comparator<? super T> comparator) argument [all...] |
H A D | ArraysParallelSortHelpers.java | 117 Comparator<? super T> comparator; field in class:ArraysParallelSortHelpers.FJObject.Sorter 120 Comparator<? super T> comparator) { 124 this.comparator = comparator; 128 Comparator<? super T> c = this.comparator; 154 Comparator<? super T> comparator; field in class:ArraysParallelSortHelpers.FJObject.Merger 158 Comparator<? super T> comparator) { 164 this.comparator = comparator; 168 Comparator<? super T> c = this.comparator; 118 Sorter(CountedCompleter<?> par, T[] a, T[] w, int base, int size, int wbase, int gran, Comparator<? super T> comparator) argument 155 Merger(CountedCompleter<?> par, T[] a, T[] w, int lbase, int lsize, int rbase, int rsize, int wbase, int gran, Comparator<? super T> comparator) argument [all...] |
H A D | TreeSet.java | 38 * comparator is provided) must be <i>consistent with equals</i> if it is to 129 * comparator. All elements inserted into the set must be <i>mutually 130 * comparable</i> by the specified comparator: {@code comparator.compare(e1, 136 * @param comparator the comparator that will be used to order this set. 140 public TreeSet(Comparator<? super E> comparator) { argument 141 this(new TreeMap<>(comparator)); 171 this(s.comparator()); 230 * and this set uses natural ordering, or its comparator 386 public Comparator<? super E> comparator() { method in class:TreeSet [all...] |
H A D | PriorityQueue.java | 92 * priority queue is ordered by comparator, or by the elements' 93 * natural ordering, if comparator is null: For each node n in the 105 * The comparator, or null if priority queue uses elements' 108 private final Comparator<? super E> comparator; field in class:PriorityQueue 140 * whose elements are ordered according to the specified comparator. 142 * @param comparator the comparator that will be used to order this 147 public PriorityQueue(Comparator<? super E> comparator) { argument 148 this(DEFAULT_INITIAL_CAPACITY, comparator); 153 * that orders its elements according to the specified comparator 162 PriorityQueue(int initialCapacity, Comparator<? super E> comparator) argument 748 public Comparator<? super E> comparator() { method in class:PriorityQueue [all...] |
/libcore/luni/src/test/java/libcore/java/util/ |
H A D | SpliteratorTester.java | 62 List<T> expectedElements, Comparator<T> comparator) { 76 Collections.sort(expectedElements, comparator); 77 Collections.sort(recorder, comparator); 118 List<T> expectedElements, Comparator<T> comparator) { 154 Collections.sort(expectedElements, comparator); 155 Collections.sort(recorder, comparator); 174 List<T> expectedElements, Comparator<T> comparator) { 175 runBasicSplitTests(spliterable.spliterator(), expectedElements, comparator); 306 public static <T> void runSortedTests(Iterable<T> spliterable, Comparator<T> comparator) { argument 314 Collections.sort(sortedElements, comparator); 61 runBasicIterationTests_unordered(Spliterator<T> spliterator, List<T> expectedElements, Comparator<T> comparator) argument 117 runBasicSplitTests(Spliterator<T> spliterator, List<T> expectedElements, Comparator<T> comparator) argument 173 runBasicSplitTests(Iterable<T> spliterable, List<T> expectedElements, Comparator<T> comparator) argument [all...] |
H A D | ComparatorTest.java | 43 private <T> void checkComparison(Comparator<T> comparator, T[] items) { argument 45 assertEquals(0, comparator.compare(items[i], items[i])); 47 assertTrue(comparator.compare(items[i], items[j]) < 0); 48 assertTrue(comparator.compare(items[j], items[i]) > 0); 54 Comparator<Item> comparator = Comparator.comparingDouble(Item::getOrderAsDouble); 55 checkComparison(comparator, orderedItems); 59 Comparator<Item> comparator = Comparator.comparingInt(Item::getOrderAsInt); 60 checkComparison(comparator, orderedItems); 64 Comparator<Item> comparator = Comparator.comparingLong(Item::getOrderAsLong); 65 checkComparison(comparator, orderedItem [all...] |
H A D | OldCollectionsTest.java | 46 private static final SerializableAssert comparator = new SerializableAssert() { field in class:OldCollectionsTest 312 assertNotNull("Assert 0: comparator must not be null", roc); 314 assertTrue("Assert 1: comparator must implement Serializable", 330 assertNotNull("Assert 0: comparator must not be null", roc); 332 assertTrue("Assert 1: comparator must implement Serializable", 342 assertNotNull("Assert 3: comparator must not be null", roc); 344 assertTrue("Assert 4: comparator must implement Serializable", 586 SerializationTest.verifySelf(Collections.EMPTY_LIST, comparator); 593 SerializationTest.verifySelf(Collections.EMPTY_MAP, comparator); 600 SerializationTest.verifySelf(Collections.EMPTY_SET, comparator); [all...] |
/libcore/ojluni/src/main/java/java/net/ |
H A D | InMemoryCookieStore.java | 335 // @param comparator the prediction to decide whether or not 339 T comparator) 344 if ((index == comparator) || (index != null && comparator.compareTo(index) == 0)) { 361 } // end of comparator.compareTo(index) == 0 338 getInternal2(List<HttpCookie> cookies, Map<T, List<HttpCookie>> cookieIndex, T comparator) argument
|
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/ |
H A D | HashSetTest.java | 218 SerializationTest.verifySelf(hs, comparator); 219 SerializationTest.verifyGolden(this, hs, comparator); 308 private static final SerializationTest.SerializableAssert comparator = new field in class:HashSetTest
|
H A D | RandomTest.java | 312 SerializationTest.verifyGolden(this, rand, comparator); 316 SerializationTest.verifySelf(rand, comparator); 319 public static final SerializationTest.SerializableAssert comparator = field in class:RandomTest
|
H A D | Collections2Test.java | 48 private static final SerializableAssert comparator = new SerializableAssert() { field in class:Collections2Test 285 assertNotNull("Assert 0: comparator must not be null", roc); 287 assertTrue("Assert 1: comparator must implement Serializable", 303 assertNotNull("Assert 0: comparator must not be null", roc); 305 assertTrue("Assert 1: comparator must implement Serializable", 315 assertNotNull("Assert 3: comparator must not be null", roc); 317 assertTrue("Assert 4: comparator must implement Serializable", 400 SerializationTest.verifySelf(Collections.EMPTY_LIST, comparator); 407 SerializationTest.verifySelf(Collections.EMPTY_MAP, comparator); 414 SerializationTest.verifySelf(Collections.EMPTY_SET, comparator); [all...] |
H A D | IdentityHashMap2Test.java | 457 private static final SerializationTest.SerializableAssert comparator = new field in class:IdentityHashMap2Test
|
H A D | IdentityHashMapTest.java | 457 SerializationTest.verifySelf(map, comparator); 458 SerializationTest.verifyGolden(this, map, comparator); 491 private static final SerializationTest.SerializableAssert comparator = new field in class:IdentityHashMapTest 1052 Comparator<Map.Entry<String, String>> comparator = 1056 SpliteratorTester.runBasicSplitTests(values, expectedValues, comparator); 1091 // comparator for IdentityHashMap objects
|
H A D | RefSortedMap.java | 88 private final Comparator<? super K> comparator; field in class:RefSortedMap 166 public Comparator<? super K> comparator() { method in class:RefSortedMap.SubMap 167 return RefSortedMap.this.comparator(); 246 return comparator != null ? comparator.compare(start, end) 251 public RefSortedMap(Comparator<? super K> comparator) { argument 252 this.comparator = comparator; 262 this(map.comparator()); 266 public Comparator<? super K> comparator() { method in class:RefSortedMap [all...] |
/libcore/support/src/test/java/org/apache/harmony/testframework/serialization/ |
H A D | SerializationTest.java | 185 // default comparator for a class that has equals(Object) method 252 * Returns <code>comparator</code> for provided serializable 255 * The <code>comparator</code> is searched in the following order: <br> 257 * selected as </code>comparator</code>.<br>- if passed <code>object</code> 267 * @return object's comparator 279 // use default comparator 283 // TODO use generics to detect comparator 291 throw new RuntimeException("Failed to detect comparator"); 313 * <code>object</code> using specified <code>comparator</code>. 317 * @param comparator 319 verifyGolden(Object test, Object object, SerializableAssert comparator) argument 356 verifyGolden(Object test, Object[] objects, SerializableAssert comparator) argument 386 verifySelf(Object object, SerializableAssert comparator) argument 415 verifySelf(Object[] objects, SerializableAssert comparator) argument [all...] |
/libcore/ojluni/src/main/java/java/util/concurrent/ |
H A D | ConcurrentSkipListSet.java | 119 * the specified comparator. 121 * @param comparator the comparator that will be used to order this set. 125 public ConcurrentSkipListSet(Comparator<? super E> comparator) { argument 126 m = new ConcurrentSkipListMap<E,Object>(comparator); 154 m = new ConcurrentSkipListMap<E,Object>(s.comparator()); 390 public Comparator<? super E> comparator() { method in class:ConcurrentSkipListSet 391 return m.comparator(); 475 * {@link Collections#reverseOrder(Comparator) Collections.reverseOrder}{@code (comparator())}. 494 * <p>The spliterator's comparator (se [all...] |
H A D | PriorityBlockingQueue.java | 145 * priority queue is ordered by comparator, or by the elements' 146 * natural ordering, if comparator is null: For each node n in the 158 * The comparator, or null if priority queue uses elements' 161 private transient Comparator<? super E> comparator; field in class:PriorityBlockingQueue 210 * comparator. 213 * @param comparator the comparator that will be used to order this 220 Comparator<? super E> comparator) { 225 this.comparator = comparator; 219 PriorityBlockingQueue(int initialCapacity, Comparator<? super E> comparator) argument 588 public Comparator<? super E> comparator() { method in class:PriorityBlockingQueue [all...] |
/libcore/ojluni/src/main/java/java/util/stream/ |
H A D | SortedOps.java | 59 * @param comparator the comparator to order elements by 62 Comparator<? super T> comparator) { 63 return new OfRef<>(upstream, comparator); 104 private final Comparator<? super T> comparator; field in class:SortedOps.OfRef 117 this.comparator = comp; 121 * Sort using the provided comparator. 123 * @param comparator The comparator to be used to evaluate ordering. 125 OfRef(AbstractPipeline<?, T, ?> upstream, Comparator<? super T> comparator) { argument 61 makeRef(AbstractPipeline<?, T, ?> upstream, Comparator<? super T> comparator) argument 305 protected final Comparator<? super T> comparator; field in class:SortedOps.AbstractRefSortingSink 309 AbstractRefSortingSink(Sink<? super T> downstream, Comparator<? super T> comparator) argument 334 SizedRefSortingSink(Sink<? super T> sink, Comparator<? super T> comparator) argument 374 RefSortingSink(Sink<? super T> sink, Comparator<? super T> comparator) argument [all...] |
H A D | Stream.java | 384 * @param comparator a <a href="package-summary.html#NonInterference">non-interfering</a>, 389 Stream<T> sorted(Comparator<? super T> comparator); argument 813 * @param comparator a <a href="package-summary.html#NonInterference">non-interfering</a>, 820 Optional<T> min(Comparator<? super T> comparator); argument 830 * @param comparator a <a href="package-summary.html#NonInterference">non-interfering</a>, 837 Optional<T> max(Comparator<? super T> comparator); argument
|
H A D | Collectors.java | 423 * reducing(BinaryOperator.minBy(comparator)) 427 * @param comparator a {@code Comparator} for comparing elements 431 minBy(Comparator<? super T> comparator) { argument 432 return reducing(BinaryOperator.minBy(comparator)); 442 * reducing(BinaryOperator.maxBy(comparator)) 446 * @param comparator a {@code Comparator} for comparing elements 450 maxBy(Comparator<? super T> comparator) { argument 451 return reducing(BinaryOperator.maxBy(comparator));
|