parent
992ab3c9f2
commit
b5eb4fcc8d
|
@ -923,7 +923,7 @@ public class CollectionUtils {
|
||||||
* @since 4.1
|
* @since 4.1
|
||||||
*/
|
*/
|
||||||
public static <O, R extends Collection<? super O>> R select(final Iterable<? extends O> inputCollection,
|
public static <O, R extends Collection<? super O>> R select(final Iterable<? extends O> inputCollection,
|
||||||
final Predicate<? super O> predicate, final R outputCollection, final R rejectedCollection) {
|
final Predicate<? super O> predicate, R outputCollection, R rejectedCollection) {
|
||||||
|
|
||||||
if (inputCollection != null && predicate != null) {
|
if (inputCollection != null && predicate != null) {
|
||||||
for (final O element : inputCollection) {
|
for (final O element : inputCollection) {
|
||||||
|
@ -1506,8 +1506,8 @@ public class CollectionUtils {
|
||||||
* @throws NullPointerException if either collection is null
|
* @throws NullPointerException if either collection is null
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
public static <O extends Comparable<? super O>> List<O> collate(final Iterable<? extends O> a,
|
public static <O extends Comparable<? super O>> List<O> collate(Iterable<? extends O> a,
|
||||||
final Iterable<? extends O> b) {
|
Iterable<? extends O> b) {
|
||||||
return collate(a, b, ComparatorUtils.<O>naturalComparator(), true);
|
return collate(a, b, ComparatorUtils.<O>naturalComparator(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1688,7 +1688,7 @@ public class CollectionUtils {
|
||||||
|
|
||||||
final Transformer<E, EquatorWrapper<E>> transformer = new Transformer<E, EquatorWrapper<E>>() {
|
final Transformer<E, EquatorWrapper<E>> transformer = new Transformer<E, EquatorWrapper<E>>() {
|
||||||
@Override
|
@Override
|
||||||
public EquatorWrapper<E> transform(final E input) {
|
public EquatorWrapper<E> transform(E input) {
|
||||||
return new EquatorWrapper<>(equator, input);
|
return new EquatorWrapper<>(equator, input);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1764,7 +1764,7 @@ public class CollectionUtils {
|
||||||
|
|
||||||
final Transformer<E, EquatorWrapper<E>> transformer = new Transformer<E, EquatorWrapper<E>>() {
|
final Transformer<E, EquatorWrapper<E>> transformer = new Transformer<E, EquatorWrapper<E>>() {
|
||||||
@Override
|
@Override
|
||||||
public EquatorWrapper<E> transform(final E input) {
|
public EquatorWrapper<E> transform(E input) {
|
||||||
return new EquatorWrapper<>(equator, input);
|
return new EquatorWrapper<>(equator, input);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -172,7 +172,7 @@ public class IterableUtils {
|
||||||
public Iterator<E> iterator() {
|
public Iterator<E> iterator() {
|
||||||
return new LazyIteratorChain<E>() {
|
return new LazyIteratorChain<E>() {
|
||||||
@Override
|
@Override
|
||||||
protected Iterator<? extends E> nextIterator(final int count) {
|
protected Iterator<? extends E> nextIterator(int count) {
|
||||||
if (count > iterables.length) {
|
if (count > iterables.length) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
|
@ -325,7 +325,7 @@ public class IterableUtils {
|
||||||
public Iterator<E> iterator() {
|
public Iterator<E> iterator() {
|
||||||
return new LazyIteratorChain<E>() {
|
return new LazyIteratorChain<E>() {
|
||||||
@Override
|
@Override
|
||||||
protected Iterator<? extends E> nextIterator(final int count) {
|
protected Iterator<? extends E> nextIterator(int count) {
|
||||||
if (IterableUtils.isEmpty(iterable)) {
|
if (IterableUtils.isEmpty(iterable)) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -433,7 +433,7 @@ public class IteratorUtils {
|
||||||
* @throws IllegalArgumentException if max is negative
|
* @throws IllegalArgumentException if max is negative
|
||||||
* @since 4.1
|
* @since 4.1
|
||||||
*/
|
*/
|
||||||
public static <E> BoundedIterator<E> boundedIterator(final Iterator<? extends E> iterator, final long max) {
|
public static <E> BoundedIterator<E> boundedIterator(final Iterator<? extends E> iterator, long max) {
|
||||||
return boundedIterator(iterator, 0, max);
|
return boundedIterator(iterator, 0, max);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -455,7 +455,7 @@ public class IteratorUtils {
|
||||||
* @since 4.1
|
* @since 4.1
|
||||||
*/
|
*/
|
||||||
public static <E> BoundedIterator<E> boundedIterator(final Iterator<? extends E> iterator,
|
public static <E> BoundedIterator<E> boundedIterator(final Iterator<? extends E> iterator,
|
||||||
final long offset, final long max) {
|
long offset, long max) {
|
||||||
return new BoundedIterator<>(iterator, offset, max);
|
return new BoundedIterator<>(iterator, offset, max);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -890,7 +890,7 @@ public class IteratorUtils {
|
||||||
* @throws IllegalArgumentException if offset is negative
|
* @throws IllegalArgumentException if offset is negative
|
||||||
* @since 4.1
|
* @since 4.1
|
||||||
*/
|
*/
|
||||||
public static <E> SkippingIterator<E> skippingIterator(final Iterator<E> iterator, final long offset) {
|
public static <E> SkippingIterator<E> skippingIterator(final Iterator<E> iterator, long offset) {
|
||||||
return new SkippingIterator<>(iterator, offset);
|
return new SkippingIterator<>(iterator, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -613,7 +613,7 @@ public class ListUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Character get( final int index ) {
|
public Character get( int index ) {
|
||||||
return Character.valueOf(sequence.charAt( index ));
|
return Character.valueOf(sequence.charAt( index ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1798,7 +1798,7 @@ public class MapUtils {
|
||||||
* @param map a Map or null
|
* @param map a Map or null
|
||||||
* @return the given map size or 0 if the map is null
|
* @return the given map size or 0 if the map is null
|
||||||
*/
|
*/
|
||||||
public static int size(final Map<?, ?> map) {
|
public static int size(Map<?, ?> map) {
|
||||||
return map == null ? 0 : map.size();
|
return map == null ? 0 : map.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -446,7 +446,7 @@ public class SetUtils {
|
||||||
|
|
||||||
return new SetView<E>() {
|
return new SetView<E>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean contains(final Object o) {
|
public boolean contains(Object o) {
|
||||||
return a.contains(o) || b.contains(o);
|
return a.contains(o) || b.contains(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -488,14 +488,14 @@ public class SetUtils {
|
||||||
|
|
||||||
final Predicate<E> notContainedInB = new Predicate<E>() {
|
final Predicate<E> notContainedInB = new Predicate<E>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean evaluate(final E object) {
|
public boolean evaluate(E object) {
|
||||||
return !b.contains(object);
|
return !b.contains(object);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return new SetView<E>() {
|
return new SetView<E>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean contains(final Object o) {
|
public boolean contains(Object o) {
|
||||||
return a.contains(o) && !b.contains(o);
|
return a.contains(o) && !b.contains(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -526,14 +526,14 @@ public class SetUtils {
|
||||||
|
|
||||||
final Predicate<E> containedInB = new Predicate<E>() {
|
final Predicate<E> containedInB = new Predicate<E>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean evaluate(final E object) {
|
public boolean evaluate(E object) {
|
||||||
return b.contains(object);
|
return b.contains(object);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return new SetView<E>() {
|
return new SetView<E>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean contains(final Object o) {
|
public boolean contains(Object o) {
|
||||||
return a.contains(o) && b.contains(o);
|
return a.contains(o) && b.contains(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -570,7 +570,7 @@ public class SetUtils {
|
||||||
|
|
||||||
return new SetView<E>() {
|
return new SetView<E>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean contains(final Object o) {
|
public boolean contains(Object o) {
|
||||||
return a.contains(o) ^ b.contains(o);
|
return a.contains(o) ^ b.contains(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ public abstract class AbstractKeyValue<K, V> implements KeyValue<K, V> {
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected K setKey(final K key) {
|
protected K setKey(K key) {
|
||||||
final K old = this.key;
|
final K old = this.key;
|
||||||
this.key = key;
|
this.key = key;
|
||||||
return old;
|
return old;
|
||||||
|
@ -69,7 +69,7 @@ public abstract class AbstractKeyValue<K, V> implements KeyValue<K, V> {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected V setValue(final V value) {
|
protected V setValue(V value) {
|
||||||
final V old = this.value;
|
final V old = this.value;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
return old;
|
return old;
|
||||||
|
|
|
@ -1059,7 +1059,7 @@ public abstract class AbstractReferenceMap<K, V> extends AbstractHashedMap<K, V>
|
||||||
* @param type the type to check against.
|
* @param type the type to check against.
|
||||||
* @return true if keyType has the specified type
|
* @return true if keyType has the specified type
|
||||||
*/
|
*/
|
||||||
protected boolean isKeyType(final ReferenceStrength type) {
|
protected boolean isKeyType(ReferenceStrength type) {
|
||||||
return this.keyType == type;
|
return this.keyType == type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -427,7 +427,7 @@ public class MultiValueMap<K, V> extends AbstractMapDecorator<K, Object> impleme
|
||||||
|
|
||||||
return new LazyIteratorChain<Entry<K, V>>() {
|
return new LazyIteratorChain<Entry<K, V>>() {
|
||||||
@Override
|
@Override
|
||||||
protected Iterator<? extends Entry<K, V>> nextIterator(final int count) {
|
protected Iterator<? extends Entry<K, V>> nextIterator(int count) {
|
||||||
if ( ! keyIterator.hasNext() ) {
|
if ( ! keyIterator.hasNext() ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -445,7 +445,7 @@ public class MultiValueMap<K, V> extends AbstractMapDecorator<K, Object> impleme
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public V setValue(final V value) {
|
public V setValue(V value) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -564,7 +564,7 @@ public class MultiValueMap<K, V> extends AbstractMapDecorator<K, Object> impleme
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void readObject(final ObjectInputStream is) throws IOException, ClassNotFoundException {
|
private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException {
|
||||||
is.defaultReadObject();
|
is.defaultReadObject();
|
||||||
// ensure that the de-serialized class is a Collection, COLLECTIONS-580
|
// ensure that the de-serialized class is a Collection, COLLECTIONS-580
|
||||||
if (clazz != null && !Collection.class.isAssignableFrom(clazz)) {
|
if (clazz != null && !Collection.class.isAssignableFrom(clazz)) {
|
||||||
|
|
|
@ -96,7 +96,7 @@ public abstract class AbstractListValuedMap<K, V> extends AbstractMultiValuedMap
|
||||||
* unmodifiable list for no mapping found.
|
* unmodifiable list for no mapping found.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<V> remove(final Object key) {
|
public List<V> remove(Object key) {
|
||||||
return ListUtils.emptyIfNull(getMap().remove(key));
|
return ListUtils.emptyIfNull(getMap().remove(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ public abstract class AbstractListValuedMap<K, V> extends AbstractMultiValuedMap
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void add(final int index, final V value) {
|
public void add(int index, V value) {
|
||||||
List<V> list = getMapping();
|
List<V> list = getMapping();
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
list = createCollection();
|
list = createCollection();
|
||||||
|
@ -126,7 +126,7 @@ public abstract class AbstractListValuedMap<K, V> extends AbstractMultiValuedMap
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean addAll(final int index, final Collection<? extends V> c) {
|
public boolean addAll(int index, Collection<? extends V> c) {
|
||||||
List<V> list = getMapping();
|
List<V> list = getMapping();
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
list = createCollection();
|
list = createCollection();
|
||||||
|
@ -140,19 +140,19 @@ public abstract class AbstractListValuedMap<K, V> extends AbstractMultiValuedMap
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V get(final int index) {
|
public V get(int index) {
|
||||||
final List<V> list = ListUtils.emptyIfNull(getMapping());
|
final List<V> list = ListUtils.emptyIfNull(getMapping());
|
||||||
return list.get(index);
|
return list.get(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int indexOf(final Object o) {
|
public int indexOf(Object o) {
|
||||||
final List<V> list = ListUtils.emptyIfNull(getMapping());
|
final List<V> list = ListUtils.emptyIfNull(getMapping());
|
||||||
return list.indexOf(o);
|
return list.indexOf(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int lastIndexOf(final Object o) {
|
public int lastIndexOf(Object o) {
|
||||||
final List<V> list = ListUtils.emptyIfNull(getMapping());
|
final List<V> list = ListUtils.emptyIfNull(getMapping());
|
||||||
return list.lastIndexOf(o);
|
return list.lastIndexOf(o);
|
||||||
}
|
}
|
||||||
|
@ -163,12 +163,12 @@ public abstract class AbstractListValuedMap<K, V> extends AbstractMultiValuedMap
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ListIterator<V> listIterator(final int index) {
|
public ListIterator<V> listIterator(int index) {
|
||||||
return new ValuesListIterator(key, index);
|
return new ValuesListIterator(key, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V remove(final int index) {
|
public V remove(int index) {
|
||||||
final List<V> list = ListUtils.emptyIfNull(getMapping());
|
final List<V> list = ListUtils.emptyIfNull(getMapping());
|
||||||
V value = list.remove(index);
|
V value = list.remove(index);
|
||||||
if (list.isEmpty()) {
|
if (list.isEmpty()) {
|
||||||
|
@ -178,19 +178,19 @@ public abstract class AbstractListValuedMap<K, V> extends AbstractMultiValuedMap
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V set(final int index, final V value) {
|
public V set(int index, V value) {
|
||||||
final List<V> list = ListUtils.emptyIfNull(getMapping());
|
final List<V> list = ListUtils.emptyIfNull(getMapping());
|
||||||
return list.set(index, value);
|
return list.set(index, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<V> subList(final int fromIndex, final int toIndex) {
|
public List<V> subList(int fromIndex, int toIndex) {
|
||||||
final List<V> list = ListUtils.emptyIfNull(getMapping());
|
final List<V> list = ListUtils.emptyIfNull(getMapping());
|
||||||
return list.subList(fromIndex, toIndex);
|
return list.subList(fromIndex, toIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object other) {
|
public boolean equals(Object other) {
|
||||||
final List<V> list = getMapping();
|
final List<V> list = getMapping();
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
return Collections.emptyList().equals(other);
|
return Collections.emptyList().equals(other);
|
||||||
|
@ -223,14 +223,14 @@ public abstract class AbstractListValuedMap<K, V> extends AbstractMultiValuedMap
|
||||||
this.iterator = values.listIterator();
|
this.iterator = values.listIterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ValuesListIterator(final K key, final int index) {
|
public ValuesListIterator(final K key, int index) {
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.values = ListUtils.emptyIfNull(getMap().get(key));
|
this.values = ListUtils.emptyIfNull(getMap().get(key));
|
||||||
this.iterator = values.listIterator(index);
|
this.iterator = values.listIterator(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void add(final V value) {
|
public void add(V value) {
|
||||||
if (getMap().get(key) == null) {
|
if (getMap().get(key) == null) {
|
||||||
List<V> list = createCollection();
|
List<V> list = createCollection();
|
||||||
getMap().put(key, list);
|
getMap().put(key, list);
|
||||||
|
@ -279,7 +279,7 @@ public abstract class AbstractListValuedMap<K, V> extends AbstractMultiValuedMap
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void set(final V value) {
|
public void set(V value) {
|
||||||
iterator.set(value);
|
iterator.set(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
|
||||||
* @param map the map to wrap
|
* @param map the map to wrap
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
protected void setMap(final Map<K, ? extends Collection<V>> map) {
|
protected void setMap(Map<K, ? extends Collection<V>> map) {
|
||||||
this.map = (Map<K, Collection<V>>) map;
|
this.map = (Map<K, Collection<V>>) map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public boolean containsKey(final Object key) {
|
public boolean containsKey(Object key) {
|
||||||
return getMap().containsKey(key);
|
return getMap().containsKey(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean containsMapping(final Object key, final Object value) {
|
public boolean containsMapping(Object key, Object value) {
|
||||||
Collection<V> coll = getMap().get(key);
|
Collection<V> coll = getMap().get(key);
|
||||||
return coll != null && coll.contains(value);
|
return coll != null && coll.contains(value);
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,7 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
|
||||||
* empty, unmodifiable collection for no mapping found
|
* empty, unmodifiable collection for no mapping found
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Collection<V> remove(final Object key) {
|
public Collection<V> remove(Object key) {
|
||||||
return CollectionUtils.emptyIfNull(getMap().remove(key));
|
return CollectionUtils.emptyIfNull(getMap().remove(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,7 +370,7 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -415,7 +415,7 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean add(final V value) {
|
public boolean add(V value) {
|
||||||
Collection<V> coll = getMapping();
|
Collection<V> coll = getMapping();
|
||||||
if (coll == null) {
|
if (coll == null) {
|
||||||
coll = createCollection();
|
coll = createCollection();
|
||||||
|
@ -425,7 +425,7 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean addAll(final Collection<? extends V> other) {
|
public boolean addAll(Collection<? extends V> other) {
|
||||||
Collection<V> coll = getMapping();
|
Collection<V> coll = getMapping();
|
||||||
if (coll == null) {
|
if (coll == null) {
|
||||||
coll = createCollection();
|
coll = createCollection();
|
||||||
|
@ -460,13 +460,13 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean contains(final Object obj) {
|
public boolean contains(Object obj) {
|
||||||
final Collection<V> coll = getMapping();
|
final Collection<V> coll = getMapping();
|
||||||
return coll == null ? false : coll.contains(obj);
|
return coll == null ? false : coll.contains(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean containsAll(final Collection<?> other) {
|
public boolean containsAll(Collection<?> other) {
|
||||||
final Collection<V> coll = getMapping();
|
final Collection<V> coll = getMapping();
|
||||||
return coll == null ? false : coll.containsAll(other);
|
return coll == null ? false : coll.containsAll(other);
|
||||||
}
|
}
|
||||||
|
@ -478,7 +478,7 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean remove(final Object item) {
|
public boolean remove(Object item) {
|
||||||
final Collection<V> coll = getMapping();
|
final Collection<V> coll = getMapping();
|
||||||
if (coll == null) {
|
if (coll == null) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -492,7 +492,7 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean removeAll(final Collection<?> c) {
|
public boolean removeAll(Collection<?> c) {
|
||||||
final Collection<V> coll = getMapping();
|
final Collection<V> coll = getMapping();
|
||||||
if (coll == null) {
|
if (coll == null) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -506,7 +506,7 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean retainAll(final Collection<?> c) {
|
public boolean retainAll(Collection<?> c) {
|
||||||
final Collection<V> coll = getMapping();
|
final Collection<V> coll = getMapping();
|
||||||
if (coll == null) {
|
if (coll == null) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -530,7 +530,7 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <T> T[] toArray(final T[] a) {
|
public <T> T[] toArray(T[] a) {
|
||||||
final Collection<V> coll = getMapping();
|
final Collection<V> coll = getMapping();
|
||||||
if (coll == null) {
|
if (coll == null) {
|
||||||
return (T[]) CollectionUtils.EMPTY_COLLECTION.toArray(a);
|
return (T[]) CollectionUtils.EMPTY_COLLECTION.toArray(a);
|
||||||
|
@ -555,7 +555,7 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
|
||||||
private class KeysMultiSet extends AbstractMultiSet<K> {
|
private class KeysMultiSet extends AbstractMultiSet<K> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean contains(final Object o) {
|
public boolean contains(Object o) {
|
||||||
return getMap().containsKey(o);
|
return getMap().containsKey(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -575,7 +575,7 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getCount(final Object object) {
|
public int getCount(Object object) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
Collection<V> col = AbstractMultiValuedMap.this.getMap().get(object);
|
Collection<V> col = AbstractMultiValuedMap.this.getMap().get(object);
|
||||||
if (col != null) {
|
if (col != null) {
|
||||||
|
@ -622,7 +622,7 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
|
||||||
final Iterator<K> keyIterator = keysCol.iterator();
|
final Iterator<K> keyIterator = keysCol.iterator();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Iterator<? extends Entry<K, V>> nextIterator(final int count) {
|
protected Iterator<? extends Entry<K, V>> nextIterator(int count) {
|
||||||
if (!keyIterator.hasNext()) {
|
if (!keyIterator.hasNext()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -652,12 +652,12 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
|
||||||
*/
|
*/
|
||||||
private class MultiValuedMapEntry extends AbstractMapEntry<K, V> {
|
private class MultiValuedMapEntry extends AbstractMapEntry<K, V> {
|
||||||
|
|
||||||
public MultiValuedMapEntry(final K key, final V value) {
|
public MultiValuedMapEntry(K key, V value) {
|
||||||
super(key, value);
|
super(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V setValue(final V value) {
|
public V setValue(V value) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -709,7 +709,7 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V setValue(final V value) {
|
public V setValue(V value) {
|
||||||
if (current == null) {
|
if (current == null) {
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
|
@ -791,12 +791,12 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean containsKey(final Object key) {
|
public boolean containsKey(Object key) {
|
||||||
return decoratedMap.containsKey(key);
|
return decoratedMap.containsKey(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<V> get(final Object key) {
|
public Collection<V> get(Object key) {
|
||||||
Collection<V> collection = decoratedMap.get(key);
|
Collection<V> collection = decoratedMap.get(key);
|
||||||
if (collection == null) {
|
if (collection == null) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -817,7 +817,7 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<V> remove(final Object key) {
|
public Collection<V> remove(Object key) {
|
||||||
Collection<V> collection = decoratedMap.remove(key);
|
Collection<V> collection = decoratedMap.remove(key);
|
||||||
if (collection == null) {
|
if (collection == null) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -830,7 +830,7 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object object) {
|
public boolean equals(Object object) {
|
||||||
return this == object || decoratedMap.equals(object);
|
return this == object || decoratedMap.equals(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -867,12 +867,12 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean contains(final Object o) {
|
public boolean contains(Object o) {
|
||||||
return decoratedMap.entrySet().contains(o);
|
return decoratedMap.entrySet().contains(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean remove(final Object o) {
|
public boolean remove(Object o) {
|
||||||
if (!contains(o)) {
|
if (!contains(o)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -887,7 +887,7 @@ public abstract class AbstractMultiValuedMap<K, V> implements MultiValuedMap<K,
|
||||||
*/
|
*/
|
||||||
class AsMapEntrySetIterator extends AbstractIteratorDecorator<Map.Entry<K, Collection<V>>> {
|
class AsMapEntrySetIterator extends AbstractIteratorDecorator<Map.Entry<K, Collection<V>>> {
|
||||||
|
|
||||||
AsMapEntrySetIterator(final Iterator<Map.Entry<K, Collection<V>>> iterator) {
|
AsMapEntrySetIterator(Iterator<Map.Entry<K, Collection<V>>> iterator) {
|
||||||
super(iterator);
|
super(iterator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ public abstract class AbstractMultiValuedMapDecorator<K, V>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean put(final K key, final V value) {
|
public boolean put(K key, V value) {
|
||||||
return decorated().put(key, value);
|
return decorated().put(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,17 +147,17 @@ public abstract class AbstractMultiValuedMapDecorator<K, V>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean putAll(final K key, final Iterable<? extends V> values) {
|
public boolean putAll(K key, Iterable<? extends V> values) {
|
||||||
return decorated().putAll(key, values);
|
return decorated().putAll(key, values);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean putAll(final Map<? extends K, ? extends V> map) {
|
public boolean putAll(Map<? extends K, ? extends V> map) {
|
||||||
return decorated().putAll(map);
|
return decorated().putAll(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean putAll(final MultiValuedMap<? extends K, ? extends V> map) {
|
public boolean putAll(MultiValuedMap<? extends K, ? extends V> map) {
|
||||||
return decorated().putAll(map);
|
return decorated().putAll(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ public abstract class AbstractSetValuedMap<K, V> extends AbstractMultiValuedMap<
|
||||||
* @param map the map to wrap, must not be null
|
* @param map the map to wrap, must not be null
|
||||||
* @throws NullPointerException if the map is null
|
* @throws NullPointerException if the map is null
|
||||||
*/
|
*/
|
||||||
protected AbstractSetValuedMap(final Map<K, ? extends Set<V>> map) {
|
protected AbstractSetValuedMap(Map<K, ? extends Set<V>> map) {
|
||||||
super(map);
|
super(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ public abstract class AbstractSetValuedMap<K, V> extends AbstractMultiValuedMap<
|
||||||
* unmodifiable set for no mapping found.
|
* unmodifiable set for no mapping found.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Set<V> remove(final Object key) {
|
public Set<V> remove(Object key) {
|
||||||
return SetUtils.emptyIfNull(getMap().remove(key));
|
return SetUtils.emptyIfNull(getMap().remove(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ public abstract class AbstractSetValuedMap<K, V> extends AbstractMultiValuedMap<
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object other) {
|
public boolean equals(Object other) {
|
||||||
final Set<V> set = (Set<V>) getMapping();
|
final Set<V> set = (Set<V>) getMapping();
|
||||||
if (set == null) {
|
if (set == null) {
|
||||||
return Collections.emptySet().equals(other);
|
return Collections.emptySet().equals(other);
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class ArrayListValuedHashMap<K, V> extends AbstractListValuedMap<K, V>
|
||||||
*
|
*
|
||||||
* @param initialListCapacity the initial capacity used for value collections
|
* @param initialListCapacity the initial capacity used for value collections
|
||||||
*/
|
*/
|
||||||
public ArrayListValuedHashMap(final int initialListCapacity) {
|
public ArrayListValuedHashMap(int initialListCapacity) {
|
||||||
this(DEFAULT_INITIAL_MAP_CAPACITY, initialListCapacity);
|
this(DEFAULT_INITIAL_MAP_CAPACITY, initialListCapacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ public class ArrayListValuedHashMap<K, V> extends AbstractListValuedMap<K, V>
|
||||||
* @param initialMapCapacity the initial hashmap capacity
|
* @param initialMapCapacity the initial hashmap capacity
|
||||||
* @param initialListCapacity the initial capacity used for value collections
|
* @param initialListCapacity the initial capacity used for value collections
|
||||||
*/
|
*/
|
||||||
public ArrayListValuedHashMap(final int initialMapCapacity, final int initialListCapacity) {
|
public ArrayListValuedHashMap(int initialMapCapacity, int initialListCapacity) {
|
||||||
super(new HashMap<K, ArrayList<V>>(initialMapCapacity));
|
super(new HashMap<K, ArrayList<V>>(initialMapCapacity));
|
||||||
this.initialListCapacity = initialListCapacity;
|
this.initialListCapacity = initialListCapacity;
|
||||||
}
|
}
|
||||||
|
@ -128,12 +128,12 @@ public class ArrayListValuedHashMap<K, V> extends AbstractListValuedMap<K, V>
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
private void writeObject(final ObjectOutputStream oos) throws IOException {
|
private void writeObject(ObjectOutputStream oos) throws IOException {
|
||||||
oos.defaultWriteObject();
|
oos.defaultWriteObject();
|
||||||
doWriteObject(oos);
|
doWriteObject(oos);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void readObject(final ObjectInputStream ois) throws IOException, ClassNotFoundException {
|
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
|
||||||
ois.defaultReadObject();
|
ois.defaultReadObject();
|
||||||
setMap(new HashMap<K, ArrayList<V>>());
|
setMap(new HashMap<K, ArrayList<V>>());
|
||||||
doReadObject(ois);
|
doReadObject(ois);
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class HashSetValuedHashMap<K, V> extends AbstractSetValuedMap<K, V>
|
||||||
*
|
*
|
||||||
* @param initialSetCapacity the initial capacity used for value collections
|
* @param initialSetCapacity the initial capacity used for value collections
|
||||||
*/
|
*/
|
||||||
public HashSetValuedHashMap(final int initialSetCapacity) {
|
public HashSetValuedHashMap(int initialSetCapacity) {
|
||||||
this(DEFAULT_INITIAL_MAP_CAPACITY, initialSetCapacity);
|
this(DEFAULT_INITIAL_MAP_CAPACITY, initialSetCapacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ public class HashSetValuedHashMap<K, V> extends AbstractSetValuedMap<K, V>
|
||||||
* @param initialMapCapacity the initial hashmap capacity
|
* @param initialMapCapacity the initial hashmap capacity
|
||||||
* @param initialSetCapacity the initial capacity used for value collections
|
* @param initialSetCapacity the initial capacity used for value collections
|
||||||
*/
|
*/
|
||||||
public HashSetValuedHashMap(final int initialMapCapacity, final int initialSetCapacity) {
|
public HashSetValuedHashMap(int initialMapCapacity, int initialSetCapacity) {
|
||||||
super(new HashMap<K, HashSet<V>>(initialMapCapacity));
|
super(new HashMap<K, HashSet<V>>(initialMapCapacity));
|
||||||
this.initialSetCapacity = initialSetCapacity;
|
this.initialSetCapacity = initialSetCapacity;
|
||||||
}
|
}
|
||||||
|
@ -116,12 +116,12 @@ public class HashSetValuedHashMap<K, V> extends AbstractSetValuedMap<K, V>
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
private void writeObject(final ObjectOutputStream oos) throws IOException {
|
private void writeObject(ObjectOutputStream oos) throws IOException {
|
||||||
oos.defaultWriteObject();
|
oos.defaultWriteObject();
|
||||||
doWriteObject(oos);
|
doWriteObject(oos);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void readObject(final ObjectInputStream ois) throws IOException, ClassNotFoundException {
|
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
|
||||||
ois.defaultReadObject();
|
ois.defaultReadObject();
|
||||||
setMap(new HashMap<K, HashSet<V>>());
|
setMap(new HashMap<K, HashSet<V>>());
|
||||||
doReadObject(ois);
|
doReadObject(ois);
|
||||||
|
|
|
@ -60,7 +60,7 @@ public final class UnmodifiableMultiValuedMap<K, V>
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static <K, V> UnmodifiableMultiValuedMap<K, V> unmodifiableMultiValuedMap(
|
public static <K, V> UnmodifiableMultiValuedMap<K, V> unmodifiableMultiValuedMap(
|
||||||
final MultiValuedMap<? extends K, ? extends V> map) {
|
MultiValuedMap<? extends K, ? extends V> map) {
|
||||||
if (map instanceof Unmodifiable) {
|
if (map instanceof Unmodifiable) {
|
||||||
return (UnmodifiableMultiValuedMap<K, V>) map;
|
return (UnmodifiableMultiValuedMap<K, V>) map;
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ public abstract class AbstractMapMultiSet<E> extends AbstractMultiSet<E> {
|
||||||
*
|
*
|
||||||
* @param map the map to wrap
|
* @param map the map to wrap
|
||||||
*/
|
*/
|
||||||
protected void setMap(final Map<E, MutableInteger> map) {
|
protected void setMap(Map<E, MutableInteger> map) {
|
||||||
this.map = map;
|
this.map = map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -257,7 +257,7 @@ public abstract class AbstractMultiSet<E> extends AbstractCollection<E> implemen
|
||||||
protected Iterator<E> createUniqueSetIterator() {
|
protected Iterator<E> createUniqueSetIterator() {
|
||||||
final Transformer<Entry<E>, E> transformer = new Transformer<Entry<E>, E>() {
|
final Transformer<Entry<E>, E> transformer = new Transformer<Entry<E>, E>() {
|
||||||
@Override
|
@Override
|
||||||
public E transform(final Entry<E> entry) {
|
public E transform(Entry<E> entry) {
|
||||||
return entry.getElement();
|
return entry.getElement();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -411,7 +411,7 @@ public abstract class AbstractMultiSet<E> extends AbstractCollection<E> implemen
|
||||||
protected static abstract class AbstractEntry<E> implements Entry<E> {
|
protected static abstract class AbstractEntry<E> implements Entry<E> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object object) {
|
public boolean equals(Object object) {
|
||||||
if (object instanceof Entry) {
|
if (object instanceof Entry) {
|
||||||
final Entry<?> other = (Entry<?>) object;
|
final Entry<?> other = (Entry<?>) object;
|
||||||
final E element = this.getElement();
|
final E element = this.getElement();
|
||||||
|
|
|
@ -79,7 +79,7 @@ public abstract class AbstractMultiSetDecorator<E>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int setCount(final E object, final int count) {
|
public int setCount(E object, int count) {
|
||||||
return decorated().setCount(object, count);
|
return decorated().setCount(object, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@ public class PredicatedMultiSet<E> extends PredicatedCollection<E> implements Mu
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int setCount(final E object, final int count) {
|
public int setCount(E object, int count) {
|
||||||
validate(object);
|
validate(object);
|
||||||
return decorated().setCount(object, count);
|
return decorated().setCount(object, count);
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@ public class SynchronizedMultiSet<E> extends SynchronizedCollection<E> implement
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int setCount(final E object, final int count) {
|
public int setCount(E object, int count) {
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
return decorated().setCount(object, count);
|
return decorated().setCount(object, count);
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,7 +136,7 @@ public final class UnmodifiableMultiSet<E>
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
@Override
|
@Override
|
||||||
public int setCount(final E object, final int count) {
|
public int setCount(E object, int count) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -282,7 +282,7 @@ public class CircularFifoQueue<E> extends AbstractCollection<E>
|
||||||
* @throws NullPointerException if the given element is null
|
* @throws NullPointerException if the given element is null
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean offer(final E element) {
|
public boolean offer(E element) {
|
||||||
return add(element);
|
return add(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,22 +64,22 @@ public abstract class AbstractNavigableSetDecorator<E>
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public E lower(final E e) {
|
public E lower(E e) {
|
||||||
return decorated().lower(e);
|
return decorated().lower(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public E floor(final E e) {
|
public E floor(E e) {
|
||||||
return decorated().floor(e);
|
return decorated().floor(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public E ceiling(final E e) {
|
public E ceiling(E e) {
|
||||||
return decorated().ceiling(e);
|
return decorated().ceiling(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public E higher(final E e) {
|
public E higher(E e) {
|
||||||
return decorated().higher(e);
|
return decorated().higher(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,17 +104,17 @@ public abstract class AbstractNavigableSetDecorator<E>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NavigableSet<E> subSet(final E fromElement, final boolean fromInclusive, final E toElement, final boolean toInclusive) {
|
public NavigableSet<E> subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) {
|
||||||
return decorated().subSet(fromElement, fromInclusive, toElement, toInclusive);
|
return decorated().subSet(fromElement, fromInclusive, toElement, toInclusive);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NavigableSet<E> headSet(final E toElement, final boolean inclusive) {
|
public NavigableSet<E> headSet(E toElement, boolean inclusive) {
|
||||||
return decorated().headSet(toElement, inclusive);
|
return decorated().headSet(toElement, inclusive);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NavigableSet<E> tailSet(final E fromElement, final boolean inclusive) {
|
public NavigableSet<E> tailSet(E fromElement, boolean inclusive) {
|
||||||
return decorated().tailSet(fromElement, inclusive);
|
return decorated().tailSet(fromElement, inclusive);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,22 +91,22 @@ public class PredicatedNavigableSet<E> extends PredicatedSortedSet<E> implements
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public E lower(final E e) {
|
public E lower(E e) {
|
||||||
return decorated().lower(e);
|
return decorated().lower(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public E floor(final E e) {
|
public E floor(E e) {
|
||||||
return decorated().floor(e);
|
return decorated().floor(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public E ceiling(final E e) {
|
public E ceiling(E e) {
|
||||||
return decorated().ceiling(e);
|
return decorated().ceiling(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public E higher(final E e) {
|
public E higher(E e) {
|
||||||
return decorated().higher(e);
|
return decorated().higher(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,19 +131,19 @@ public class PredicatedNavigableSet<E> extends PredicatedSortedSet<E> implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NavigableSet<E> subSet(final E fromElement, final boolean fromInclusive, final E toElement, final boolean toInclusive) {
|
public NavigableSet<E> subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) {
|
||||||
final NavigableSet<E> sub = decorated().subSet(fromElement, fromInclusive, toElement, toInclusive);
|
final NavigableSet<E> sub = decorated().subSet(fromElement, fromInclusive, toElement, toInclusive);
|
||||||
return predicatedNavigableSet(sub, predicate);
|
return predicatedNavigableSet(sub, predicate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NavigableSet<E> headSet(final E toElement, final boolean inclusive) {
|
public NavigableSet<E> headSet(E toElement, boolean inclusive) {
|
||||||
final NavigableSet<E> head = decorated().headSet(toElement, inclusive);
|
final NavigableSet<E> head = decorated().headSet(toElement, inclusive);
|
||||||
return predicatedNavigableSet(head, predicate);
|
return predicatedNavigableSet(head, predicate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NavigableSet<E> tailSet(final E fromElement, final boolean inclusive) {
|
public NavigableSet<E> tailSet(E fromElement, boolean inclusive) {
|
||||||
final NavigableSet<E> tail = decorated().tailSet(fromElement, inclusive);
|
final NavigableSet<E> tail = decorated().tailSet(fromElement, inclusive);
|
||||||
return predicatedNavigableSet(tail, predicate);
|
return predicatedNavigableSet(tail, predicate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,22 +112,22 @@ public class TransformedNavigableSet<E> extends TransformedSortedSet<E> implemen
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public E lower(final E e) {
|
public E lower(E e) {
|
||||||
return decorated().lower(e);
|
return decorated().lower(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public E floor(final E e) {
|
public E floor(E e) {
|
||||||
return decorated().floor(e);
|
return decorated().floor(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public E ceiling(final E e) {
|
public E ceiling(E e) {
|
||||||
return decorated().ceiling(e);
|
return decorated().ceiling(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public E higher(final E e) {
|
public E higher(E e) {
|
||||||
return decorated().higher(e);
|
return decorated().higher(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,19 +152,19 @@ public class TransformedNavigableSet<E> extends TransformedSortedSet<E> implemen
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NavigableSet<E> subSet(final E fromElement, final boolean fromInclusive, final E toElement, final boolean toInclusive) {
|
public NavigableSet<E> subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) {
|
||||||
final NavigableSet<E> sub = decorated().subSet(fromElement, fromInclusive, toElement, toInclusive);
|
final NavigableSet<E> sub = decorated().subSet(fromElement, fromInclusive, toElement, toInclusive);
|
||||||
return transformingNavigableSet(sub, transformer);
|
return transformingNavigableSet(sub, transformer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NavigableSet<E> headSet(final E toElement, final boolean inclusive) {
|
public NavigableSet<E> headSet(E toElement, boolean inclusive) {
|
||||||
final NavigableSet<E> head = decorated().headSet(toElement, inclusive);
|
final NavigableSet<E> head = decorated().headSet(toElement, inclusive);
|
||||||
return transformingNavigableSet(head, transformer);
|
return transformingNavigableSet(head, transformer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NavigableSet<E> tailSet(final E fromElement, final boolean inclusive) {
|
public NavigableSet<E> tailSet(E fromElement, boolean inclusive) {
|
||||||
final NavigableSet<E> tail = decorated().tailSet(fromElement, inclusive);
|
final NavigableSet<E> tail = decorated().tailSet(fromElement, inclusive);
|
||||||
return transformingNavigableSet(tail, transformer);
|
return transformingNavigableSet(tail, transformer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,19 +136,19 @@ public final class UnmodifiableNavigableSet<E>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NavigableSet<E> subSet(final E fromElement, final boolean fromInclusive, final E toElement, final boolean toInclusive) {
|
public NavigableSet<E> subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) {
|
||||||
final NavigableSet<E> sub = decorated().subSet(fromElement, fromInclusive, toElement, toInclusive);
|
final NavigableSet<E> sub = decorated().subSet(fromElement, fromInclusive, toElement, toInclusive);
|
||||||
return unmodifiableNavigableSet(sub);
|
return unmodifiableNavigableSet(sub);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NavigableSet<E> headSet(final E toElement, final boolean inclusive) {
|
public NavigableSet<E> headSet(E toElement, boolean inclusive) {
|
||||||
final NavigableSet<E> head = decorated().headSet(toElement, inclusive);
|
final NavigableSet<E> head = decorated().headSet(toElement, inclusive);
|
||||||
return unmodifiableNavigableSet(head);
|
return unmodifiableNavigableSet(head);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NavigableSet<E> tailSet(final E fromElement, final boolean inclusive) {
|
public NavigableSet<E> tailSet(E fromElement, boolean inclusive) {
|
||||||
final NavigableSet<E> tail = decorated().tailSet(fromElement, inclusive);
|
final NavigableSet<E> tail = decorated().tailSet(fromElement, inclusive);
|
||||||
return unmodifiableNavigableSet(tail);
|
return unmodifiableNavigableSet(tail);
|
||||||
}
|
}
|
||||||
|
|
|
@ -180,12 +180,12 @@ public class UnmodifiableTrie<K, V> implements Trie<K, V>, Serializable, Unmodif
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public K nextKey(final K key) {
|
public K nextKey(K key) {
|
||||||
return delegate.nextKey(key);
|
return delegate.nextKey(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public K previousKey(final K key) {
|
public K previousKey(K key) {
|
||||||
return delegate.previousKey(key);
|
return delegate.previousKey(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -702,7 +702,7 @@ public class CollectionUtilsTest extends MockTestCase {
|
||||||
final StringBuffer result = new StringBuffer();
|
final StringBuffer result = new StringBuffer();
|
||||||
result.append(CollectionUtils.forAllButLastDo(strings, new Closure<String>() {
|
result.append(CollectionUtils.forAllButLastDo(strings, new Closure<String>() {
|
||||||
@Override
|
@Override
|
||||||
public void execute(final String input) {
|
public void execute(String input) {
|
||||||
result.append(input+";");
|
result.append(input+";");
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
@ -712,7 +712,7 @@ public class CollectionUtilsTest extends MockTestCase {
|
||||||
final StringBuffer resultOne = new StringBuffer();
|
final StringBuffer resultOne = new StringBuffer();
|
||||||
resultOne.append(CollectionUtils.forAllButLastDo(oneString, new Closure<String>() {
|
resultOne.append(CollectionUtils.forAllButLastDo(oneString, new Closure<String>() {
|
||||||
@Override
|
@Override
|
||||||
public void execute(final String input) {
|
public void execute(String input) {
|
||||||
resultOne.append(input+";");
|
resultOne.append(input+";");
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
@ -1800,7 +1800,7 @@ public class CollectionUtilsTest extends MockTestCase {
|
||||||
|
|
||||||
Predicate<Integer> lessThanFive = new Predicate<Integer>() {
|
Predicate<Integer> lessThanFive = new Predicate<Integer>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean evaluate(final Integer object) {
|
public boolean evaluate(Integer object) {
|
||||||
return object < 5;
|
return object < 5;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1808,7 +1808,7 @@ public class CollectionUtilsTest extends MockTestCase {
|
||||||
|
|
||||||
Predicate<Integer> lessThanFour = new Predicate<Integer>() {
|
Predicate<Integer> lessThanFour = new Predicate<Integer>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean evaluate(final Integer object) {
|
public boolean evaluate(Integer object) {
|
||||||
return object < 4;
|
return object < 4;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1834,12 +1834,12 @@ public class CollectionUtilsTest extends MockTestCase {
|
||||||
final Collection<String> result = CollectionUtils.removeAll(base, remove, new Equator<String>() {
|
final Collection<String> result = CollectionUtils.removeAll(base, remove, new Equator<String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equate(final String o1, final String o2) {
|
public boolean equate(String o1, String o2) {
|
||||||
return o1.charAt(1) == o2.charAt(1);
|
return o1.charAt(1) == o2.charAt(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hash(final String o) {
|
public int hash(String o) {
|
||||||
return o.charAt(1);
|
return o.charAt(1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1886,12 +1886,12 @@ public class CollectionUtilsTest extends MockTestCase {
|
||||||
final Collection<String> result = CollectionUtils.retainAll(base, retain, new Equator<String>() {
|
final Collection<String> result = CollectionUtils.retainAll(base, retain, new Equator<String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equate(final String o1, final String o2) {
|
public boolean equate(String o1, String o2) {
|
||||||
return o1.charAt(1) == o2.charAt(1);
|
return o1.charAt(1) == o2.charAt(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hash(final String o) {
|
public int hash(String o) {
|
||||||
return o.charAt(1);
|
return o.charAt(1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -200,7 +200,7 @@ public class FluentIterableTest {
|
||||||
public void filter() {
|
public void filter() {
|
||||||
Predicate<Integer> smallerThan3 = new Predicate<Integer>() {
|
Predicate<Integer> smallerThan3 = new Predicate<Integer>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean evaluate(final Integer object) {
|
public boolean evaluate(Integer object) {
|
||||||
return object.intValue() < 3;
|
return object.intValue() < 3;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -225,7 +225,7 @@ public class FluentIterableTest {
|
||||||
final AtomicInteger sum = new AtomicInteger(0);
|
final AtomicInteger sum = new AtomicInteger(0);
|
||||||
Closure<Integer> closure = new Closure<Integer>() {
|
Closure<Integer> closure = new Closure<Integer>() {
|
||||||
@Override
|
@Override
|
||||||
public void execute(final Integer input) {
|
public void execute(Integer input) {
|
||||||
sum.addAndGet(input);
|
sum.addAndGet(input);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -317,7 +317,7 @@ public class FluentIterableTest {
|
||||||
public void transform() {
|
public void transform() {
|
||||||
Transformer<Integer, Integer> squared = new Transformer<Integer, Integer>() {
|
Transformer<Integer, Integer> squared = new Transformer<Integer, Integer>() {
|
||||||
@Override
|
@Override
|
||||||
public Integer transform(final Integer object) {
|
public Integer transform(Integer object) {
|
||||||
return object * object;
|
return object * object;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -184,12 +184,12 @@ public class IterableUtilsTest {
|
||||||
final Equator<String> secondLetterEquator = new Equator<String>() {
|
final Equator<String> secondLetterEquator = new Equator<String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equate(final String o1, final String o2) {
|
public boolean equate(String o1, String o2) {
|
||||||
return o1.charAt(1) == o2.charAt(1);
|
return o1.charAt(1) == o2.charAt(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hash(final String o) {
|
public int hash(String o) {
|
||||||
return o.charAt(1);
|
return o.charAt(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -375,7 +375,7 @@ public class IterableUtilsTest {
|
||||||
|
|
||||||
Predicate<Integer> lessThanFive = new Predicate<Integer>() {
|
Predicate<Integer> lessThanFive = new Predicate<Integer>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean evaluate(final Integer object) {
|
public boolean evaluate(Integer object) {
|
||||||
return object < 5;
|
return object < 5;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -383,7 +383,7 @@ public class IterableUtilsTest {
|
||||||
|
|
||||||
Predicate<Integer> lessThanFour = new Predicate<Integer>() {
|
Predicate<Integer> lessThanFour = new Predicate<Integer>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean evaluate(final Integer object) {
|
public boolean evaluate(Integer object) {
|
||||||
return object < 4;
|
return object < 4;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -487,7 +487,7 @@ public class IterableUtilsTest {
|
||||||
|
|
||||||
result = IterableUtils.toString(iterableA, new Transformer<Integer, String>() {
|
result = IterableUtils.toString(iterableA, new Transformer<Integer, String>() {
|
||||||
@Override
|
@Override
|
||||||
public String transform(final Integer input) {
|
public String transform(Integer input) {
|
||||||
return new Integer(input * 2).toString();
|
return new Integer(input * 2).toString();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -495,7 +495,7 @@ public class IterableUtilsTest {
|
||||||
|
|
||||||
result = IterableUtils.toString(new ArrayList<Integer>(), new Transformer<Integer, String>() {
|
result = IterableUtils.toString(new ArrayList<Integer>(), new Transformer<Integer, String>() {
|
||||||
@Override
|
@Override
|
||||||
public String transform(final Integer input) {
|
public String transform(Integer input) {
|
||||||
fail("not supposed to reach here");
|
fail("not supposed to reach here");
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -504,7 +504,7 @@ public class IterableUtilsTest {
|
||||||
|
|
||||||
result = IterableUtils.toString(null, new Transformer<Integer, String>() {
|
result = IterableUtils.toString(null, new Transformer<Integer, String>() {
|
||||||
@Override
|
@Override
|
||||||
public String transform(final Integer input) {
|
public String transform(Integer input) {
|
||||||
fail("not supposed to reach here");
|
fail("not supposed to reach here");
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -517,7 +517,7 @@ public class IterableUtilsTest {
|
||||||
|
|
||||||
Transformer<Integer, String> transformer = new Transformer<Integer, String>() {
|
Transformer<Integer, String> transformer = new Transformer<Integer, String>() {
|
||||||
@Override
|
@Override
|
||||||
public String transform(final Integer input) {
|
public String transform(Integer input) {
|
||||||
return new Integer(input * 2).toString();
|
return new Integer(input * 2).toString();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -554,7 +554,7 @@ public class IterableUtilsTest {
|
||||||
public void testToStringWithNullArguments() {
|
public void testToStringWithNullArguments() {
|
||||||
String result = IterableUtils.toString(null, new Transformer<Integer, String>() {
|
String result = IterableUtils.toString(null, new Transformer<Integer, String>() {
|
||||||
@Override
|
@Override
|
||||||
public String transform(final Integer input) {
|
public String transform(Integer input) {
|
||||||
fail("not supposed to reach here");
|
fail("not supposed to reach here");
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -571,7 +571,7 @@ public class IterableUtilsTest {
|
||||||
try {
|
try {
|
||||||
IterableUtils.toString(new ArrayList<Integer>(), new Transformer<Integer, String>() {
|
IterableUtils.toString(new ArrayList<Integer>(), new Transformer<Integer, String>() {
|
||||||
@Override
|
@Override
|
||||||
public String transform(final Integer input) {
|
public String transform(Integer input) {
|
||||||
fail("not supposed to reach here");
|
fail("not supposed to reach here");
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -584,7 +584,7 @@ public class IterableUtilsTest {
|
||||||
try {
|
try {
|
||||||
IterableUtils.toString(new ArrayList<Integer>(), new Transformer<Integer, String>() {
|
IterableUtils.toString(new ArrayList<Integer>(), new Transformer<Integer, String>() {
|
||||||
@Override
|
@Override
|
||||||
public String transform(final Integer input) {
|
public String transform(Integer input) {
|
||||||
fail("not supposed to reach here");
|
fail("not supposed to reach here");
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -597,7 +597,7 @@ public class IterableUtilsTest {
|
||||||
try {
|
try {
|
||||||
IterableUtils.toString(new ArrayList<Integer>(), new Transformer<Integer, String>() {
|
IterableUtils.toString(new ArrayList<Integer>(), new Transformer<Integer, String>() {
|
||||||
@Override
|
@Override
|
||||||
public String transform(final Integer input) {
|
public String transform(Integer input) {
|
||||||
fail("not supposed to reach here");
|
fail("not supposed to reach here");
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -824,13 +824,13 @@ public class MapUtilsTest {
|
||||||
int key;
|
int key;
|
||||||
String name;
|
String name;
|
||||||
|
|
||||||
public X(final int key, final String name) {
|
public X(int key, String name) {
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(final X o) {
|
public int compareTo(X o) {
|
||||||
return key - o.key | name.compareTo(o.name);
|
return key - o.key | name.compareTo(o.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -850,7 +850,7 @@ public class MapUtilsTest {
|
||||||
final MultiValueMap<Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<Integer, Collection<X>>());
|
final MultiValueMap<Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<Integer, Collection<X>>());
|
||||||
MapUtils.populateMap(map, list, new Transformer<X, Integer>() {
|
MapUtils.populateMap(map, list, new Transformer<X, Integer>() {
|
||||||
@Override
|
@Override
|
||||||
public Integer transform(final X input) {
|
public Integer transform(X input) {
|
||||||
return input.key;
|
return input.key;
|
||||||
}
|
}
|
||||||
}, TransformerUtils.<X> nopTransformer());
|
}, TransformerUtils.<X> nopTransformer());
|
||||||
|
|
|
@ -249,7 +249,7 @@ public class TransformerUtilsTest {
|
||||||
|
|
||||||
Predicate<Integer> lessThanFivePredicate = new Predicate<Integer>() {
|
Predicate<Integer> lessThanFivePredicate = new Predicate<Integer>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean evaluate(final Integer value) {
|
public boolean evaluate(Integer value) {
|
||||||
return value < 5;
|
return value < 5;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class TreeBagTest<T> extends AbstractSortedBagTest<T> {
|
||||||
|
|
||||||
final Bag<String> bag2 = new TreeBag<>(new Comparator<String>() {
|
final Bag<String> bag2 = new TreeBag<>(new Comparator<String>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(final String o1, final String o2) {
|
public int compare(String o1, String o2) {
|
||||||
return o1.compareTo(o2);
|
return o1.compareTo(o2);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -137,7 +137,7 @@ public class PredicatedCollectionBuilderTest {
|
||||||
|
|
||||||
private static class OddPredicate implements Predicate<Integer> {
|
private static class OddPredicate implements Predicate<Integer> {
|
||||||
@Override
|
@Override
|
||||||
public boolean evaluate(final Integer value) {
|
public boolean evaluate(Integer value) {
|
||||||
return value % 2 == 1;
|
return value % 2 == 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,7 +134,7 @@ public class PeekingIteratorTest<E> extends AbstractIteratorTest<E> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validate(final Iterator<E> iter, final E... items) {
|
private void validate(Iterator<E> iter, E... items) {
|
||||||
for (E x : items) {
|
for (E x : items) {
|
||||||
assertTrue(iter.hasNext());
|
assertTrue(iter.hasNext());
|
||||||
assertEquals(x, iter.next());
|
assertEquals(x, iter.next());
|
||||||
|
|
|
@ -109,7 +109,7 @@ public class PushbackIteratorTest<E> extends AbstractIteratorTest<E> {
|
||||||
validate(iter, "c");
|
validate(iter, "c");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validate(final Iterator<E> iter, final Object... items) {
|
private void validate(Iterator<E> iter, Object... items) {
|
||||||
for (final Object x : items) {
|
for (final Object x : items) {
|
||||||
assertTrue(iter.hasNext());
|
assertTrue(iter.hasNext());
|
||||||
assertEquals(x, iter.next());
|
assertEquals(x, iter.next());
|
||||||
|
|
|
@ -258,7 +258,7 @@ public class MultiKeyTest extends TestCase {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1928896152249821416L;
|
private static final long serialVersionUID = 1928896152249821416L;
|
||||||
|
|
||||||
public DerivedMultiKey(final T key1, final T key2) {
|
public DerivedMultiKey(T key1, T key2) {
|
||||||
super(key1, key2);
|
super(key1, key2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -407,7 +407,7 @@ public class MultiValueMapTest<K, V> extends AbstractObjectTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] serialize(final Object object) throws IOException {
|
private byte[] serialize(Object object) throws IOException {
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
ObjectOutputStream oos = new ObjectOutputStream(baos);
|
ObjectOutputStream oos = new ObjectOutputStream(baos);
|
||||||
|
|
||||||
|
@ -417,7 +417,7 @@ public class MultiValueMapTest<K, V> extends AbstractObjectTest {
|
||||||
return baos.toByteArray();
|
return baos.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object deserialize(final byte[] data) throws IOException, ClassNotFoundException {
|
private Object deserialize(byte[] data) throws IOException, ClassNotFoundException {
|
||||||
ByteArrayInputStream bais = new ByteArrayInputStream(data);
|
ByteArrayInputStream bais = new ByteArrayInputStream(data);
|
||||||
ObjectInputStream iis = new ObjectInputStream(bais);
|
ObjectInputStream iis = new ObjectInputStream(bais);
|
||||||
|
|
||||||
|
|
|
@ -234,7 +234,7 @@ public class PassiveExpiringMapTest<K, V> extends AbstractMapTest<K, V> {
|
||||||
new PassiveExpiringMap.ConstantTimeToLiveExpirationPolicy<String, String>(1, TimeUnit.SECONDS)), 1000);
|
new PassiveExpiringMap.ConstantTimeToLiveExpirationPolicy<String, String>(1, TimeUnit.SECONDS)), 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateExpiration(final Map<String, String> map, final long timeout) {
|
private void validateExpiration(final Map<String, String> map, long timeout) {
|
||||||
map.put("a", "b");
|
map.put("a", "b");
|
||||||
|
|
||||||
assertNotNull(map.get("a"));
|
assertNotNull(map.get("a"));
|
||||||
|
|
|
@ -57,7 +57,7 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
|
||||||
/** MultiValuedHashMap created by reset(). */
|
/** MultiValuedHashMap created by reset(). */
|
||||||
protected MultiValuedMap<K, V> confirmed;
|
protected MultiValuedMap<K, V> confirmed;
|
||||||
|
|
||||||
public AbstractMultiValuedMapTest(final String testName) {
|
public AbstractMultiValuedMapTest(String testName) {
|
||||||
super(testName);
|
super(testName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addSampleMappings(final MultiValuedMap<? super K, ? super V> map) {
|
protected void addSampleMappings(MultiValuedMap<? super K, ? super V> map) {
|
||||||
final K[] keys = getSampleKeys();
|
final K[] keys = getSampleKeys();
|
||||||
final V[] values = getSampleValues();
|
final V[] values = getSampleValues();
|
||||||
for (int i = 0; i < keys.length; i++) {
|
for (int i = 0; i < keys.length; i++) {
|
||||||
|
@ -168,7 +168,7 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
|
||||||
return this.confirmed;
|
return this.confirmed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setConfirmed(final MultiValuedMap<K, V> map) {
|
public void setConfirmed(MultiValuedMap<K, V> map) {
|
||||||
this.confirmed = map;
|
this.confirmed = map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ import org.apache.commons.collections4.MultiValuedMap;
|
||||||
*/
|
*/
|
||||||
public class ArrayListValuedHashMapTest<K, V> extends AbstractMultiValuedMapTest<K, V> {
|
public class ArrayListValuedHashMapTest<K, V> extends AbstractMultiValuedMapTest<K, V> {
|
||||||
|
|
||||||
public ArrayListValuedHashMapTest(final String testName) {
|
public ArrayListValuedHashMapTest(String testName) {
|
||||||
super(testName);
|
super(testName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ import org.apache.commons.collections4.SetValuedMap;
|
||||||
*/
|
*/
|
||||||
public class HashSetValuedHashMapTest<K, V> extends AbstractMultiValuedMapTest<K, V> {
|
public class HashSetValuedHashMapTest<K, V> extends AbstractMultiValuedMapTest<K, V> {
|
||||||
|
|
||||||
public HashSetValuedHashMapTest(final String testName) {
|
public HashSetValuedHashMapTest(String testName) {
|
||||||
super(testName);
|
super(testName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.commons.collections4.collection.TransformedCollectionTest;
|
||||||
*/
|
*/
|
||||||
public class TransformedMultiValuedMapTest<K, V> extends AbstractMultiValuedMapTest<K, V> {
|
public class TransformedMultiValuedMapTest<K, V> extends AbstractMultiValuedMapTest<K, V> {
|
||||||
|
|
||||||
public TransformedMultiValuedMapTest(final String testName) {
|
public TransformedMultiValuedMapTest(String testName) {
|
||||||
super(testName);
|
super(testName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ import org.apache.commons.collections4.Unmodifiable;
|
||||||
*/
|
*/
|
||||||
public class UnmodifiableMultiValuedMapTest<K, V> extends AbstractMultiValuedMapTest<K, V> {
|
public class UnmodifiableMultiValuedMapTest<K, V> extends AbstractMultiValuedMapTest<K, V> {
|
||||||
|
|
||||||
public UnmodifiableMultiValuedMapTest(final String testName) {
|
public UnmodifiableMultiValuedMapTest(String testName) {
|
||||||
super(testName);
|
super(testName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue