Searched defs:comparator (Results 1 - 25 of 31) sorted by relevance

12

/libcore/ojluni/src/main/java/java/util/function/
H A DBinaryOperator.java51 * @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 DCollectionUtils.java83 * 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 DHttpRetryExceptionTest.java34 // 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 DSortedMap.java39 * 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 DSortedSet.java38 * 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 DComparator.java45 * 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 DArraysParallelSortHelpers.java117 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 DTreeSet.java38 * 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 DPriorityQueue.java92 * 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 DSpliteratorTester.java53 ArrayList<T> expectedElements, Comparator<T> comparator) {
63 Collections.sort(expectedElements, comparator);
64 Collections.sort(recorder, comparator);
105 ArrayList<T> expectedElements, Comparator<T> comparator) {
137 Collections.sort(expectedElements, comparator);
138 Collections.sort(recorder, comparator);
150 ArrayList<T> expectedElements, Comparator<T> comparator) {
151 runBasicSplitTests(spliterable.spliterator(), expectedElements, comparator);
222 public static <T> void runSortedTests(Iterable<T> spliterable, Comparator<T> comparator) { argument
230 Collections.sort(sortedElements, comparator);
52 runBasicIterationTests_unordered(Spliterator<T> spliterator, ArrayList<T> expectedElements, Comparator<T> comparator) argument
104 runBasicSplitTests(Spliterator<T> spliterator, ArrayList<T> expectedElements, Comparator<T> comparator) argument
149 runBasicSplitTests(Iterable<T> spliterable, ArrayList<T> expectedElements, Comparator<T> comparator) argument
[all...]
H A DComparatorTest.java43 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 DOldCollectionsTest.java46 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 DInMemoryCookieStore.java303 // @param comparator the prediction to decide whether or not
307 T comparator)
311 if ((index == comparator) || (index != null && comparator.compareTo(index) == 0)) {
328 } // end of comparator.compareTo(index) == 0
306 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 DHashSetTest.java218 SerializationTest.verifySelf(hs, comparator);
219 SerializationTest.verifyGolden(this, hs, comparator);
307 private static final SerializationTest.SerializableAssert comparator = new field in class:HashSetTest
H A DRandomTest.java312 SerializationTest.verifyGolden(this, rand, comparator);
316 SerializationTest.verifySelf(rand, comparator);
319 public static final SerializationTest.SerializableAssert comparator = field in class:RandomTest
H A DCollections2Test.java48 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 DIdentityHashMap2Test.java457 private static final SerializationTest.SerializableAssert comparator = new field in class:IdentityHashMap2Test
H A DIdentityHashMapTest.java457 SerializationTest.verifySelf(map, comparator);
458 SerializationTest.verifyGolden(this, map, comparator);
491 private static final SerializationTest.SerializableAssert comparator = new field in class:IdentityHashMapTest
1050 Comparator<Map.Entry<String, String>> comparator =
1054 SpliteratorTester.runBasicSplitTests(values, expectedValues, comparator);
1087 // comparator for IdentityHashMap objects
H A DRefSortedMap.java88 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/ojluni/src/main/java/sun/security/provider/certpath/
H A DForwardBuilder.java72 private Comparator<X509Certificate> comparator; field in class:ForwardBuilder
96 comparator = new PKIXCertComparator(trustedSubjectDNs);
125 Set<X509Certificate> certs = new TreeSet<>(comparator);
443 * return 0 because the comparator would behave strangely
447 * certs are equal so that this comparator behaves
/libcore/support/src/test/java/org/apache/harmony/testframework/serialization/
H A DSerializationTest.java185 // 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(TestCase test, Object object, SerializableAssert comparator) argument
356 verifyGolden(TestCase test, Object[] objects, SerializableAssert comparator) argument
386 verifySelf(Object object, SerializableAssert comparator) argument
415 verifySelf(Object[] objects, SerializableAssert comparator) argument
[all...]
/libcore/luni/src/main/java/java/util/concurrent/
H A DConcurrentSkipListSet.java90 * the specified comparator.
92 * @param comparator the comparator that will be used to order this set.
96 public ConcurrentSkipListSet(Comparator<? super E> comparator) { argument
97 m = new ConcurrentSkipListMap<E,Object>(comparator);
125 m = new ConcurrentSkipListMap<E,Object>(s.comparator());
361 public Comparator<? super E> comparator() { method in class:ConcurrentSkipListSet
362 return m.comparator();
446 * {@link Collections#reverseOrder(Comparator) Collections.reverseOrder}{@code (comparator())}.
465 * <p>The spliterator's comparator (se
[all...]
H A DPriorityBlockingQueue.java116 * priority queue is ordered by comparator, or by the elements'
117 * natural ordering, if comparator is null: For each node n in the
129 * The comparator, or null if priority queue uses elements'
132 private transient Comparator<? super E> comparator; field in class:PriorityBlockingQueue
181 * comparator.
184 * @param comparator the comparator that will be used to order this
191 Comparator<? super E> comparator) {
196 this.comparator = comparator;
190 PriorityBlockingQueue(int initialCapacity, Comparator<? super E> comparator) argument
559 public Comparator<? super E> comparator() { method in class:PriorityBlockingQueue
[all...]
/libcore/ojluni/src/main/java/java/util/stream/
H A DSortedOps.java59 * @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 DStream.java384 * @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

Completed in 999 milliseconds

12