_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q159000
Shell.parseAvailableResult
train
static boolean parseAvailableResult(List<String> stdout, boolean checkForRoot) { if (stdout == null) { return false; } // this is only one of many ways this can be done boolean echoSeen = false; for (String line : stdout) { if (line.contains("uid=")) { // id command is working,...
java
{ "resource": "" }
q159001
SynchronizedMutableCollection.of
train
public static <E, C extends Collection<E>> SynchronizedMutableCollection<E> of(C collection) { return new SynchronizedMutableCollection<E>(CollectionAdapter.adapt(collection)); }
java
{ "resource": "" }
q159002
CompositeFastList.defaultSort
train
@Override protected void defaultSort(Comparator<? super E> comparator) { FastList<E> list = comparator == null ? (FastList<E>) this.toSortedList() : (FastList<E>) this.toSortedList(comparator); this.lists.clear(); this.lists.add(list); }
java
{ "resource": "" }
q159003
Functions.cast
train
public static <T, V> Function<T, V> cast(Function<T, V> function) { return function; }
java
{ "resource": "" }
q159004
Functions.swappedPair
train
public static <S, T> Function<Pair<S, T>, Pair<T, S>> swappedPair() { return (Function<Pair<S, T>, Pair<T, S>>) (Function<?, ?>) SWAPPED_PAIR_FUNCTION; }
java
{ "resource": "" }
q159005
Functions.bind
train
public static <T, P, R> Function<T, R> bind(Function2<? super T, ? super P, ? extends R> function, P parameter) { return new BindFunction2<T, P, R>(function, parameter); }
java
{ "resource": "" }
q159006
Functions.bind
train
public static <T1, T2> Procedure<T1> bind( Procedure<? super T2> delegate, Function<? super T1, T2> function) { return new BindProcedure<T1, T2>(delegate, function); }
java
{ "resource": "" }
q159007
Functions.bind
train
public static <T1, T2> ObjectIntProcedure<T1> bind( ObjectIntProcedure<? super T2> delegate, Function<? super T1, T2> function) { return new BindObjectIntProcedure<T1, T2>(delegate, function); }
java
{ "resource": "" }
q159008
Functions.bind
train
public static <T1, T2, T3> Procedure2<T1, T3> bind( Procedure2<? super T2, T3> delegate, Function<? super T1, T2> function) { return new BindProcedure2<T1, T2, T3>(delegate, function); }
java
{ "resource": "" }
q159009
ArrayIterate.getFirst
train
public static <T> T getFirst(T[] objectArray) { if (ArrayIterate.notEmpty(objectArray)) { return objectArray[0]; } return null; }
java
{ "resource": "" }
q159010
ArrayIterate.getLast
train
public static <T> T getLast(T[] objectArray) { if (ArrayIterate.notEmpty(objectArray)) { return objectArray[objectArray.length - 1]; } return null; }
java
{ "resource": "" }
q159011
ArrayIterate.detectIndexWith
train
public static <T, IV> int detectIndexWith( T[] objectArray, Predicate2<? super T, IV> predicate, IV injectedValue) { if (objectArray == null) { throw new IllegalArgumentException("Cannot perform a detectIndexWith on null"); } for (int i...
java
{ "resource": "" }
q159012
ArrayIterate.toMap
train
public static <T, K, V> MutableMap<K, V> toMap( T[] objectArray, Function<? super T, ? extends K> keyFunction, Function<? super T, ? extends V> valueFunction) { MutableMap<K, V> map = UnifiedMap.newMap(); Procedure<T> procedure = new MapCollectProcedure<T, K, V>(m...
java
{ "resource": "" }
q159013
GsCollectionsCodeGenerator.generateFiles
train
public int generateFiles() { List<URL> allTemplateFilesFromClassPath = FileUtils.getAllTemplateFilesFromClasspath(this.templateDirectory, this.classPathURLs); for (URL url : allTemplateFilesFromClassPath) { this.url = url; this.templateFile = new STGroupFile(this.url,...
java
{ "resource": "" }
q159014
SynchronizedBag.of
train
public static <E, B extends MutableBag<E>> SynchronizedBag<E> of(B bag) { return new SynchronizedBag<E>(bag); }
java
{ "resource": "" }
q159015
UnmodifiableTreeMap.of
train
public static <K, V, M extends SortedMap<K, V>> UnmodifiableTreeMap<K, V> of(M map) { if (map == null) { throw new IllegalArgumentException("cannot create a UnmodifiableSortedMap for null"); } return new UnmodifiableTreeMap<K, V>(SortedMapAdapter.adapt(map)); }
java
{ "resource": "" }
q159016
RandomAccessListIterate.forEachInBoth
train
public static <T1, T2> void forEachInBoth(List<T1> list1, List<T2> list2, Procedure2<? super T1, ? super T2> procedure) { if (list1 != null && list2 != null) { int size1 = list1.size(); int size2 = list2.size(); if (size1 == size2) { fo...
java
{ "resource": "" }
q159017
RandomAccessListIterate.forEachWithIndex
train
public static <T> void forEachWithIndex(List<T> list, ObjectIntProcedure<? super T> objectIntProcedure) { int size = list.size(); for (int i = 0; i < size; i++) { objectIntProcedure.value(list.get(i), i); } }
java
{ "resource": "" }
q159018
RandomAccessListIterate.detectIndexWith
train
public static <T, IV> int detectIndexWith(List<T> list, Predicate2<? super T, ? super IV> predicate, IV injectedValue) { int size = list.size(); for (int i = 0; i < size; i++) { if (predicate.accept(list.get(i), injectedValue)) { return i; ...
java
{ "resource": "" }
q159019
UnmodifiableMutableCollection.of
train
public static <E, C extends Collection<E>> UnmodifiableMutableCollection<E> of(C collection) { if (collection == null) { throw new IllegalArgumentException("cannot create a UnmodifiableMutableCollection for null"); } return new UnmodifiableMutableCollection<E>(CollectionA...
java
{ "resource": "" }
q159020
SynchronizedRichIterable.of
train
public static <E> SynchronizedRichIterable<E> of(RichIterable<E> iterable) { return new SynchronizedRichIterable<E>(iterable); }
java
{ "resource": "" }
q159021
SynchronizedRichIterable.of
train
public static <E> SynchronizedRichIterable<E> of(RichIterable<E> iterable, Object lock) { return new SynchronizedRichIterable<E>(iterable, lock); }
java
{ "resource": "" }
q159022
ArrayProcedureFJTaskRunner.createAndExecuteTasks
train
private void createAndExecuteTasks(Executor executor, ProcedureFactory<BT> procedureFactory, T[] array) { this.procedures = new ArrayProcedureFJTask[this.taskCount]; int sectionSize = array.length / this.taskCount; int size = this.taskCount; for (int index = 0; index < size; index++)...
java
{ "resource": "" }
q159023
UnmodifiableBag.of
train
public static <E, B extends MutableBag<E>> UnmodifiableBag<E> of(B bag) { if (bag == null) { throw new IllegalArgumentException("cannot create an UnmodifiableBag for null"); } return new UnmodifiableBag<E>(bag); }
java
{ "resource": "" }
q159024
ParallelIterate.newPooledExecutor
train
public static ExecutorService newPooledExecutor(String poolName, boolean useDaemonThreads) { return ParallelIterate.newPooledExecutor(ParallelIterate.getDefaultMaxThreadPoolSize(), poolName, useDaemonThreads); }
java
{ "resource": "" }
q159025
SynchronizedMutableList.of
train
public static <E, L extends List<E>> SynchronizedMutableList<E> of(L list, Object lock) { MutableList<E> mutableList = list instanceof MutableList ? (MutableList<E>) list : ListAdapter.adapt(list); return new SynchronizedMutableList<E>(mutableList, lock); }
java
{ "resource": "" }
q159026
FastList.newWithNValues
train
public static <E> FastList<E> newWithNValues(int size, Function0<E> factory) { FastList<E> newFastList = FastList.newList(size); for (int i = 0; i < size; i++) { newFastList.add(factory.value()); } return newFastList; }
java
{ "resource": "" }
q159027
FastList.trimToSizeIfGreaterThanPercent
train
public boolean trimToSizeIfGreaterThanPercent(double loadFactor) { double excessCapacity = 1.0 - (double) this.size / (double) this.items.length; if (excessCapacity > loadFactor) { this.trimToSize(); return true; } return false; }
java
{ "resource": "" }
q159028
ListIterate.getFirst
train
public static <T> T getFirst(List<T> collection) { return Iterate.isEmpty(collection) ? null : collection.get(0); }
java
{ "resource": "" }
q159029
ListIterate.reverseForEach
train
public static <T> void reverseForEach(List<T> list, Procedure<? super T> procedure) { if (!list.isEmpty()) { ListIterate.forEach(list, list.size() - 1, 0, procedure); } }
java
{ "resource": "" }
q159030
ListIterate.reverseForEachWithIndex
train
public static <T> void reverseForEachWithIndex(List<T> list, ObjectIntProcedure<? super T> objectIntProcedure) { if (!list.isEmpty()) { ListIterate.forEachWithIndex(list, list.size() - 1, 0, objectIntProcedure); } }
java
{ "resource": "" }
q159031
ListIterate.forEachInBoth
train
public static <T1, T2> void forEachInBoth(List<T1> list1, List<T2> list2, Procedure2<? super T1, ? super T2> procedure) { if (list1 != null && list2 != null) { if (list1.size() == list2.size()) { if (list1 instanceof RandomAccess && list2 instanceof RandomAcce...
java
{ "resource": "" }
q159032
ListIterate.detectLastIndex
train
public static <T> int detectLastIndex(List<T> list, Predicate<? super T> predicate) { if (list instanceof RandomAccess) { return RandomAccessListIterate.detectLastIndex(list, predicate); } int size = list.size(); int i = size - 1; ListIterator<T> reverseIt...
java
{ "resource": "" }
q159033
StringIterate.forEachToken
train
public static void forEachToken(String string, String separator, Procedure<String> procedure) { for (StringTokenizer stringTokenizer = new StringTokenizer(string, separator); stringTokenizer.hasMoreTokens(); ) { String token = stringTokenizer.nextToken(); procedure.value(toke...
java
{ "resource": "" }
q159034
StringIterate.occurrencesOfChar
train
public static int occurrencesOfChar(String string, final char value) { return StringIterate.countChar(string, new CharPredicate() { public boolean accept(char character) { return value == character; } }); }
java
{ "resource": "" }
q159035
StringIterate.occurrencesOfCodePoint
train
public static int occurrencesOfCodePoint(String string, final int value) { return StringIterate.countCodePoint(string, new CodePointPredicate() { public boolean accept(int codePoint) { return value == codePoint; } }); }
java
{ "resource": "" }
q159036
StringIterate.chunk
train
public static MutableList<String> chunk(String string, int size) { if (size <= 0) { throw new IllegalArgumentException("Size for groups must be positive but was: " + size); } int length = string.length(); if (length == 0) { return FastList.ne...
java
{ "resource": "" }
q159037
Iterate.selectWith
train
public static <T, P, R extends Collection<T>> R selectWith( Iterable<T> iterable, Predicate2<? super T, ? super P> predicate, P parameter, R targetCollection) { if (iterable instanceof RichIterable) { return ((RichIterable<T>) iterable).sel...
java
{ "resource": "" }
q159038
Iterate.sortThisBy
train
public static <T, V extends Comparable<? super V>, L extends List<T>> L sortThisBy(L list, Function<? super T, ? extends V> function) { return Iterate.sortThis(list, Comparators.byFunction(function)); }
java
{ "resource": "" }
q159039
Iterate.removeIf
train
public static <T> boolean removeIf(Iterable<T> iterable, Predicate<? super T> predicate) { if (iterable instanceof MutableCollection) { return ((MutableCollection<T>) iterable).removeIf(predicate); } if (iterable instanceof ArrayList) { return ArrayLis...
java
{ "resource": "" }
q159040
Iterate.removeIfWith
train
public static <T, P> boolean removeIfWith( Iterable<T> iterable, Predicate2<? super T, ? super P> predicate, P parameter) { if (iterable instanceof MutableCollection) { return ((MutableCollection<T>) iterable).removeIfWith(predicate, parameter); ...
java
{ "resource": "" }
q159041
Iterate.rejectWith
train
public static <T, P, R extends Collection<T>> R rejectWith( Iterable<T> iterable, Predicate2<? super T, ? super P> predicate, P parameter, R targetCollection) { if (iterable instanceof RichIterable) { return ((RichIterable<T>) iterable).rej...
java
{ "resource": "" }
q159042
Iterate.addAllTo
train
public static <T, R extends Collection<T>> R addAllTo(Iterable<? extends T> iterable, R targetCollection) { Iterate.addAllIterable(iterable, targetCollection); return targetCollection; }
java
{ "resource": "" }
q159043
Iterate.addAllIterable
train
public static <T> boolean addAllIterable(Iterable<? extends T> iterable, Collection<T> targetCollection) { if (iterable == null) { throw new NullPointerException(); } if (iterable instanceof Collection<?>) { return targetCollection.addAll((Collection<T...
java
{ "resource": "" }
q159044
Iterate.removeAllFrom
train
public static <T, R extends Collection<T>> R removeAllFrom(Iterable<? extends T> iterable, R targetCollection) { Iterate.removeAllIterable(iterable, targetCollection); return targetCollection; }
java
{ "resource": "" }
q159045
Iterate.removeAllIterable
train
public static <T> boolean removeAllIterable(Iterable<? extends T> iterable, Collection<T> targetCollection) { if (iterable == null) { throw new NullPointerException(); } if (iterable instanceof Collection<?>) { return targetCollection.removeAll((Collec...
java
{ "resource": "" }
q159046
Iterate.collectWith
train
public static <T, P, A> Collection<A> collectWith( Iterable<T> iterable, Function2<? super T, ? super P, ? extends A> function, P parameter) { if (iterable instanceof MutableCollection) { return ((MutableCollection<T>) iterable).collectWith(function, p...
java
{ "resource": "" }
q159047
Iterate.collectWith
train
public static <T, P, A, R extends Collection<A>> R collectWith( Iterable<T> iterable, Function2<? super T, ? super P, ? extends A> function, P parameter, R targetCollection) { if (iterable instanceof RichIterable) { return ((RichIterable<T>...
java
{ "resource": "" }
q159048
Iterate.flatten
train
public static <T> Collection<T> flatten(Iterable<? extends Iterable<T>> iterable) { return Iterate.flatCollect(iterable, Functions.<Iterable<T>>identity()); }
java
{ "resource": "" }
q159049
Iterate.isEmpty
train
public static boolean isEmpty(Iterable<?> iterable) { if (iterable == null) { return true; } if (iterable instanceof RichIterable) { return ((RichIterable<?>) iterable).isEmpty(); } if (iterable instanceof Collection) { ...
java
{ "resource": "" }
q159050
Iterate.detectIfNone
train
public static <T> T detectIfNone(Iterable<T> iterable, Predicate<? super T> predicate, T ifNone) { T result = Iterate.detect(iterable, predicate); return result == null ? ifNone : result; }
java
{ "resource": "" }
q159051
Iterate.detectWithIfNone
train
public static <T, P> T detectWithIfNone( Iterable<T> iterable, Predicate2<? super T, ? super P> predicate, P parameter, T ifNone) { T result = Iterate.detectWith(iterable, predicate, parameter); return result == null ? ifNone : result; }
java
{ "resource": "" }
q159052
Iterate.detectIndex
train
public static <T> int detectIndex(Iterable<T> iterable, Predicate<? super T> predicate) { if (iterable instanceof ArrayList<?>) { return ArrayListIterate.detectIndex((ArrayList<T>) iterable, predicate); } if (iterable instanceof List<?>) { return ListI...
java
{ "resource": "" }
q159053
Iterate.detectIndexWith
train
public static <T, P> int detectIndexWith( Iterable<T> iterable, Predicate2<? super T, ? super P> predicate, P parameter) { if (iterable instanceof ArrayList<?>) { return ArrayListIterate.detectIndexWith((ArrayList<T>) iterable, predicate, parameter); ...
java
{ "resource": "" }
q159054
Iterate.sumOfBigDecimal
train
public static <T> BigDecimal sumOfBigDecimal(Iterable<T> iterable, Function<? super T, BigDecimal> function) { if (iterable instanceof List) { return ListIterate.sumOfBigDecimal((List<T>) iterable, function); } if (iterable != null) { return IterableIt...
java
{ "resource": "" }
q159055
Iterate.sumOfBigInteger
train
public static <T> BigInteger sumOfBigInteger(Iterable<T> iterable, Function<? super T, BigInteger> function) { if (iterable instanceof List) { return ListIterate.sumOfBigInteger((List<T>) iterable, function); } if (iterable != null) { return IterableIt...
java
{ "resource": "" }
q159056
Iterate.anySatisfy
train
public static <T> boolean anySatisfy(Iterable<T> iterable, Predicate<? super T> predicate) { if (iterable instanceof RichIterable) { return ((RichIterable<T>) iterable).anySatisfy(predicate); } if (iterable instanceof ArrayList) { return ArrayListItera...
java
{ "resource": "" }
q159057
Iterate.toMap
train
public static <T, K> MutableMap<K, T> toMap( Iterable<T> iterable, Function<? super T, ? extends K> keyFunction) { MutableMap<K, T> map = UnifiedMap.newMap(); Iterate.forEach(iterable, new MapCollectProcedure<T, K, T>(map, keyFunction)); return map; }
java
{ "resource": "" }
q159058
Iterate.toMap
train
public static <T, K, V> MutableMap<K, V> toMap( Iterable<T> iterable, Function<? super T, ? extends K> keyFunction, Function<? super T, ? extends V> valueFunction) { return Iterate.addToMap(iterable, keyFunction, valueFunction, UnifiedMap.<K, V>newMap()); }
java
{ "resource": "" }
q159059
Iterate.addToMap
train
public static <T, K, V, M extends Map<K, V>> M addToMap( Iterable<T> iterable, Function<? super T, ? extends K> keyFunction, M map) { Iterate.forEach(iterable, new MapCollectProcedure<T, K, V>(map, keyFunction)); return map; }
java
{ "resource": "" }
q159060
Iterate.toSortedList
train
public static <T extends Comparable<? super T>> MutableList<T> toSortedList(Iterable<T> iterable) { return Iterate.toSortedList(iterable, Comparators.naturalOrder()); }
java
{ "resource": "" }
q159061
Iterate.toSortedList
train
public static <T> MutableList<T> toSortedList(Iterable<T> iterable, Comparator<? super T> comparator) { return FastList.newList(iterable).sortThis(comparator); }
java
{ "resource": "" }
q159062
Iterate.sizeOf
train
public static int sizeOf(Iterable<?> iterable) { if (iterable instanceof Collection) { return ((Collection<?>) iterable).size(); } if (iterable instanceof RichIterable) { return ((RichIterable<?>) iterable).size(); } return Iterate.coun...
java
{ "resource": "" }
q159063
Iterate.contains
train
public static boolean contains(Iterable<?> iterable, Object value) { if (iterable instanceof Collection) { return ((Collection<?>) iterable).contains(value); } if (iterable instanceof RichIterable) { return ((RichIterable<?>) iterable).contains(value);...
java
{ "resource": "" }
q159064
Iterate.toArray
train
public static <T> Object[] toArray(Iterable<T> iterable) { if (iterable == null) { throw new NullPointerException(); } if (iterable instanceof Collection) { return ((Collection<T>) iterable).toArray(); } if (iterable instanceof RichIter...
java
{ "resource": "" }
q159065
Iterate.toArray
train
public static <T> T[] toArray(Iterable<? extends T> iterable, T[] target) { if (iterable instanceof Collection) { return ((Collection<T>) iterable).toArray(target); } if (iterable instanceof RichIterable) { return ((RichIterable<T>) iterable).toArray(t...
java
{ "resource": "" }
q159066
Iterate.maxBy
train
public static <T, V extends Comparable<? super V>> T maxBy(Iterable<T> iterable, Function<? super T, ? extends V> function) { if (iterable instanceof RichIterable) { return ((RichIterable<T>) iterable).maxBy(function); } if (iterable instanceof RandomAccess) { ...
java
{ "resource": "" }
q159067
ReflectionHelper.getConstructor
train
public static <T> Constructor<T> getConstructor(Class<T> instantiable, Class<?>... constructorParameterTypes) { try { return instantiable.getConstructor(constructorParameterTypes); } catch (NoSuchMethodException ignored) { return ReflectionHelper.searc...
java
{ "resource": "" }
q159068
Interval.oneToBy
train
public static Interval oneToBy(int count, int step) { if (count < 1) { throw new IllegalArgumentException("Only positive ranges allowed using oneToBy"); } return Interval.fromToBy(1, count, step); }
java
{ "resource": "" }
q159069
Interval.fromTo
train
public static Interval fromTo(int from, int to) { if (from <= to) { return Interval.fromToBy(from, to, 1); } return Interval.fromToBy(from, to, -1); }
java
{ "resource": "" }
q159070
Interval.evensFromTo
train
public static Interval evensFromTo(int from, int to) { if (from % 2 != 0) { if (from < to) { from++; } else { from--; } } if (to % 2 != 0) { if (to > from) ...
java
{ "resource": "" }
q159071
Interval.oddsFromTo
train
public static Interval oddsFromTo(int from, int to) { if (from % 2 == 0) { if (from < to) { from++; } else { from--; } } if (to % 2 == 0) { if (to > from) ...
java
{ "resource": "" }
q159072
Interval.toSet
train
public static MutableSet<Integer> toSet(int from, int to) { MutableSet<Integer> targetCollection = UnifiedSet.newSet(); Interval.fromTo(from, to).forEach(CollectionAddProcedure.on(targetCollection)); return targetCollection; }
java
{ "resource": "" }
q159073
Interval.toReverseList
train
public static MutableList<Integer> toReverseList(int from, int to) { return Interval.fromTo(from, to).reverseThis().toList(); }
java
{ "resource": "" }
q159074
Interval.fromToBy
train
public static Interval fromToBy(int from, int to, int stepBy) { if (stepBy == 0) { throw new IllegalArgumentException("Cannot use a step by of 0"); } if (from > to && stepBy > 0 || from < to && stepBy < 0) { throw new IllegalArgumentException("Step by ...
java
{ "resource": "" }
q159075
Interval.bigIntegerProduct
train
private BigInteger bigIntegerProduct() { return this.injectInto(BigInteger.valueOf(1L), new Function2<BigInteger, Integer, BigInteger>() { public BigInteger value(BigInteger result, Integer each) { return result.multiply(BigInteger.valueOf(each.longValue())); ...
java
{ "resource": "" }
q159076
Interval.forEach
train
public void forEach(Procedure<? super Integer> procedure, Executor executor) { CountDownLatch latch = new CountDownLatch(this.size()); if (this.goForward()) { // Iterates in forward direction because step value is negative for (int i = this.from; i <= this.to; i += th...
java
{ "resource": "" }
q159077
Interval.run
train
public void run(Runnable runnable) { if (this.goForward()) { for (int i = this.from; i <= this.to; i += this.step) { runnable.run(); } } else { for (int i = this.from; i >= this.to; i += this.step) { ...
java
{ "resource": "" }
q159078
Interval.run
train
public void run(Runnable runnable, Executor executor) { if (this.goForward()) { for (int i = this.from; i <= this.to; i += this.step) { executor.execute(runnable); } } else { for (int i = this.from; i >= this.to;...
java
{ "resource": "" }
q159079
Interval.toIntArray
train
public int[] toIntArray() { final int[] result = new int[this.size()]; this.forEachWithIndex(new IntIntProcedure() { public void value(int each, int index) { result[index] = each; } }); return result; }
java
{ "resource": "" }
q159080
MapIterate.ifPresentApply
train
public static <K, V, A> A ifPresentApply( Map<K, V> map, K key, Function<? super V, ? extends A> function) { if (map instanceof UnsortedMapIterable) { return ((MapIterable<K, V>) map).ifPresentApply(key, function); } V result = map.get(...
java
{ "resource": "" }
q159081
MapIterate.collect
train
public static <K, V, K2, V2> MutableMap<K2, V2> collect( Map<K, V> map, Function2<? super K, ? super V, Pair<K2, V2>> function) { return MapIterate.collect(map, function, UnifiedMap.<K2, V2>newMap(map.size())); }
java
{ "resource": "" }
q159082
MapIterate.collect
train
public static <K1, V1, K2, V2, R extends Map<K2, V2>> R collect( Map<K1, V1> map, final Function2<? super K1, ? super V1, Pair<K2, V2>> function, final R target) { MapIterate.forEachKeyValue(map, new Procedure2<K1, V1>() { public void value(K1 key, V1 ...
java
{ "resource": "" }
q159083
MapIterate.collect
train
public static <K1, V1, K2, V2> MutableMap<K2, V2> collect( Map<K1, V1> map, Function<? super K1, ? extends K2> keyFunction, Function<? super V1, ? extends V2> valueFunction) { return MapIterate.collect(map, keyFunction, valueFunction, UnifiedMap.<K2, V2>newMap()); }
java
{ "resource": "" }
q159084
MapIterate.collect
train
public static <K1, V1, K2, V2> MutableMap<K2, V2> collect( Map<K1, V1> map, final Function<? super K1, ? extends K2> keyFunction, final Function<? super V1, ? extends V2> valueFunction, Map<K2, V2> target) { return MapIterate.collect(map, new Function2<K1, V1,...
java
{ "resource": "" }
q159085
MapIterate.toListOfPairs
train
public static <K, V> MutableList<Pair<K, V>> toListOfPairs(Map<K, V> map) { final MutableList<Pair<K, V>> pairs = FastList.newList(map.size()); MapIterate.forEachKeyValue(map, new Procedure2<K, V>() { public void value(K key, V value) { pairs.add(Tuple...
java
{ "resource": "" }
q159086
MapIterate.toSortedList
train
public static <K, V> MutableList<V> toSortedList( Map<K, V> map, Comparator<? super V> comparator) { return Iterate.toSortedList(map.values(), comparator); }
java
{ "resource": "" }
q159087
MapIterate.occurrencesOf
train
public static <K, V> int occurrencesOf(Map<K, V> map, V object) { return Iterate.count(map.values(), Predicates.equal(object)); }
java
{ "resource": "" }
q159088
MapIterate.occurrencesOfAttribute
train
public static <K, V, A> int occurrencesOfAttribute( Map<K, V> map, Function<? super V, ? extends A> function, A object) { return Iterate.count(map.values(), Predicates.attributeEqual(function, object)); }
java
{ "resource": "" }
q159089
SynchronizedSortedSet.of
train
public static <E, S extends SortedSet<E>> SynchronizedSortedSet<E> of(S set) { return new SynchronizedSortedSet<E>(SortedSetAdapter.adapt(set)); }
java
{ "resource": "" }
q159090
SynchronizedSortedSet.of
train
public static <E, S extends SortedSet<E>> MutableSortedSet<E> of(S set, Object lock) { return new SynchronizedSortedSet<E>(SortedSetAdapter.adapt(set), lock); }
java
{ "resource": "" }
q159091
UnmodifiableSortedBag.of
train
public static <E, S extends MutableSortedBag<E>> UnmodifiableSortedBag<E> of(S bag) { if (bag == null) { throw new IllegalArgumentException("cannot create an UnmodifiableSortedBag for null"); } return new UnmodifiableSortedBag<E>(bag); }
java
{ "resource": "" }
q159092
SynchronizedMutableSet.of
train
public static <E, S extends Set<E>> SynchronizedMutableSet<E> of(S set) { return new SynchronizedMutableSet<E>(SetAdapter.adapt(set)); }
java
{ "resource": "" }
q159093
UnmodifiableMutableMap.of
train
public static <K, V, M extends Map<K, V>> UnmodifiableMutableMap<K, V> of(M map) { if (map == null) { throw new IllegalArgumentException("cannot create a UnmodifiableMutableMap for null"); } return new UnmodifiableMutableMap<K, V>(MapAdapter.adapt(map)); }
java
{ "resource": "" }
q159094
UnmodifiableSortedSet.of
train
public static <E, S extends SortedSet<E>> UnmodifiableSortedSet<E> of(S set) { if (set == null) { throw new IllegalArgumentException("cannot create an UnmodifiableSortedSet for null"); } return new UnmodifiableSortedSet<E>(SortedSetAdapter.adapt(set)); }
java
{ "resource": "" }
q159095
UnmodifiableMutableSet.of
train
public static <E, S extends Set<E>> UnmodifiableMutableSet<E> of(S set) { if (set == null) { throw new IllegalArgumentException("cannot create an UnmodifiableMutableSet for null"); } return new UnmodifiableMutableSet<E>(SetAdapter.adapt(set)); }
java
{ "resource": "" }
q159096
Comparators.byFirstOfPair
train
public static <T> SerializableComparator<Pair<T, ?>> byFirstOfPair(Comparator<? super T> comparator) { return new ByFirstOfPairComparator<T>(comparator); }
java
{ "resource": "" }
q159097
Comparators.bySecondOfPair
train
public static <T> SerializableComparator<Pair<?, T>> bySecondOfPair(Comparator<? super T> comparator) { return new BySecondOfPairComparator<T>(comparator); }
java
{ "resource": "" }
q159098
ArrayListIterate.reverseForEach
train
public static <T> void reverseForEach(ArrayList<T> list, Procedure<? super T> procedure) { if (!list.isEmpty()) { ArrayListIterate.forEach(list, list.size() - 1, 0, procedure); } }
java
{ "resource": "" }
q159099
IntInterval.oneToBy
train
public static IntInterval oneToBy(int count, int step) { if (count < 1) { throw new IllegalArgumentException("Only positive ranges allowed using oneToBy"); } return IntInterval.fromToBy(1, count, step); }
java
{ "resource": "" }