id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
116,500
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/Iterate.java
Iterate.removeAllFrom
public static <T, R extends Collection<T>> R removeAllFrom(Iterable<? extends T> iterable, R targetCollection) { Iterate.removeAllIterable(iterable, targetCollection); return targetCollection; }
java
public static <T, R extends Collection<T>> R removeAllFrom(Iterable<? extends T> iterable, R targetCollection) { Iterate.removeAllIterable(iterable, targetCollection); return targetCollection; }
[ "public", "static", "<", "T", ",", "R", "extends", "Collection", "<", "T", ">", ">", "R", "removeAllFrom", "(", "Iterable", "<", "?", "extends", "T", ">", "iterable", ",", "R", "targetCollection", ")", "{", "Iterate", ".", "removeAllIterable", "(", "iter...
Remove all elements present in Iterable from the target collection, return the target collection.
[ "Remove", "all", "elements", "present", "in", "Iterable", "from", "the", "target", "collection", "return", "the", "target", "collection", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L1142-L1146
116,501
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/Iterate.java
Iterate.removeAllIterable
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
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...
[ "public", "static", "<", "T", ">", "boolean", "removeAllIterable", "(", "Iterable", "<", "?", "extends", "T", ">", "iterable", ",", "Collection", "<", "T", ">", "targetCollection", ")", "{", "if", "(", "iterable", "==", "null", ")", "{", "throw", "new", ...
Remove all elements present in Iterable from the target collection, returns true if any element was removed.
[ "Remove", "all", "elements", "present", "in", "Iterable", "from", "the", "target", "collection", "returns", "true", "if", "any", "element", "was", "removed", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L1151-L1164
116,502
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/Iterate.java
Iterate.collectWith
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
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...
[ "public", "static", "<", "T", ",", "P", ",", "A", ">", "Collection", "<", "A", ">", "collectWith", "(", "Iterable", "<", "T", ">", "iterable", ",", "Function2", "<", "?", "super", "T", ",", "?", "super", "P", ",", "?", "extends", "A", ">", "funct...
Same as collect with a Function2 and specified parameter which is passed to the function.
[ "Same", "as", "collect", "with", "a", "Function2", "and", "specified", "parameter", "which", "is", "passed", "to", "the", "function", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L2066-L2098
116,503
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/Iterate.java
Iterate.collectWith
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
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>...
[ "public", "static", "<", "T", ",", "P", ",", "A", ",", "R", "extends", "Collection", "<", "A", ">", ">", "R", "collectWith", "(", "Iterable", "<", "T", ">", "iterable", ",", "Function2", "<", "?", "super", "T", ",", "?", "super", "P", ",", "?", ...
Same as collectWith but with a targetCollection parameter to gather the results.
[ "Same", "as", "collectWith", "but", "with", "a", "targetCollection", "parameter", "to", "gather", "the", "results", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L2103-L2126
116,504
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/Iterate.java
Iterate.flatten
public static <T> Collection<T> flatten(Iterable<? extends Iterable<T>> iterable) { return Iterate.flatCollect(iterable, Functions.<Iterable<T>>identity()); }
java
public static <T> Collection<T> flatten(Iterable<? extends Iterable<T>> iterable) { return Iterate.flatCollect(iterable, Functions.<Iterable<T>>identity()); }
[ "public", "static", "<", "T", ">", "Collection", "<", "T", ">", "flatten", "(", "Iterable", "<", "?", "extends", "Iterable", "<", "T", ">", ">", "iterable", ")", "{", "return", "Iterate", ".", "flatCollect", "(", "iterable", ",", "Functions", ".", "<",...
Flattens a collection of collections into one "flat" collection. @param iterable A list of lists, e.g. { { 1, 2, 3 }, { 4, 5 }, { 6 } } @return A flattened list, e.g. { 1, 2, 3, 4, 5, 6 }
[ "Flattens", "a", "collection", "of", "collections", "into", "one", "flat", "collection", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L2134-L2137
116,505
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/Iterate.java
Iterate.isEmpty
public static boolean isEmpty(Iterable<?> iterable) { if (iterable == null) { return true; } if (iterable instanceof RichIterable) { return ((RichIterable<?>) iterable).isEmpty(); } if (iterable instanceof Collection) { ...
java
public static boolean isEmpty(Iterable<?> iterable) { if (iterable == null) { return true; } if (iterable instanceof RichIterable) { return ((RichIterable<?>) iterable).isEmpty(); } if (iterable instanceof Collection) { ...
[ "public", "static", "boolean", "isEmpty", "(", "Iterable", "<", "?", ">", "iterable", ")", "{", "if", "(", "iterable", "==", "null", ")", "{", "return", "true", ";", "}", "if", "(", "iterable", "instanceof", "RichIterable", ")", "{", "return", "(", "("...
A null-safe check on a collection to see if it isEmpty. A null collection results in a true.
[ "A", "null", "-", "safe", "check", "on", "a", "collection", "to", "see", "if", "it", "isEmpty", ".", "A", "null", "collection", "results", "in", "a", "true", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L2185-L2200
116,506
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/Iterate.java
Iterate.detectIfNone
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
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; }
[ "public", "static", "<", "T", ">", "T", "detectIfNone", "(", "Iterable", "<", "T", ">", "iterable", ",", "Predicate", "<", "?", "super", "T", ">", "predicate", ",", "T", "ifNone", ")", "{", "T", "result", "=", "Iterate", ".", "detect", "(", "iterable...
Returns the first element of the iterable that evaluates to true for the specified predicate, or returns the result ifNone if no element evaluates to true.
[ "Returns", "the", "first", "element", "of", "the", "iterable", "that", "evaluates", "to", "true", "for", "the", "specified", "predicate", "or", "returns", "the", "result", "ifNone", "if", "no", "element", "evaluates", "to", "true", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L2334-L2338
116,507
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/Iterate.java
Iterate.detectWithIfNone
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
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; }
[ "public", "static", "<", "T", ",", "P", ">", "T", "detectWithIfNone", "(", "Iterable", "<", "T", ">", "iterable", ",", "Predicate2", "<", "?", "super", "T", ",", "?", "super", "P", ">", "predicate", ",", "P", "parameter", ",", "T", "ifNone", ")", "...
Returns the first element of the iterable that evaluates to true for the specified predicate2 and parameter, or returns the result ifNone if no element evaluates to true.
[ "Returns", "the", "first", "element", "of", "the", "iterable", "that", "evaluates", "to", "true", "for", "the", "specified", "predicate2", "and", "parameter", "or", "returns", "the", "result", "ifNone", "if", "no", "element", "evaluates", "to", "true", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L2344-L2352
116,508
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/Iterate.java
Iterate.detectIndex
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
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...
[ "public", "static", "<", "T", ">", "int", "detectIndex", "(", "Iterable", "<", "T", ">", "iterable", ",", "Predicate", "<", "?", "super", "T", ">", "predicate", ")", "{", "if", "(", "iterable", "instanceof", "ArrayList", "<", "?", ">", ")", "{", "ret...
Searches for the first occurrence where the predicate evaluates to true, returns -1 if the predicate does not evaluate to true.
[ "Searches", "for", "the", "first", "occurrence", "where", "the", "predicate", "evaluates", "to", "true", "returns", "-", "1", "if", "the", "predicate", "does", "not", "evaluate", "to", "true", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L2357-L2372
116,509
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/Iterate.java
Iterate.detectIndexWith
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
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); ...
[ "public", "static", "<", "T", ",", "P", ">", "int", "detectIndexWith", "(", "Iterable", "<", "T", ">", "iterable", ",", "Predicate2", "<", "?", "super", "T", ",", "?", "super", "P", ">", "predicate", ",", "P", "parameter", ")", "{", "if", "(", "ite...
Searches for the first occurrence where the predicate2 and parameter evaluates to true, returns -1 if the predicate2 and parameter do not evaluate to true.
[ "Searches", "for", "the", "first", "occurrence", "where", "the", "predicate2", "and", "parameter", "evaluates", "to", "true", "returns", "-", "1", "if", "the", "predicate2", "and", "parameter", "do", "not", "evaluate", "to", "true", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L2377-L2395
116,510
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/Iterate.java
Iterate.sumOfBigDecimal
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
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...
[ "public", "static", "<", "T", ">", "BigDecimal", "sumOfBigDecimal", "(", "Iterable", "<", "T", ">", "iterable", ",", "Function", "<", "?", "super", "T", ",", "BigDecimal", ">", "function", ")", "{", "if", "(", "iterable", "instanceof", "List", ")", "{", ...
Returns the BigDecimal sum of the result of applying the function to each element of the iterable. @since 6.0
[ "Returns", "the", "BigDecimal", "sum", "of", "the", "result", "of", "applying", "the", "function", "to", "each", "element", "of", "the", "iterable", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L2617-L2628
116,511
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/Iterate.java
Iterate.sumOfBigInteger
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
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...
[ "public", "static", "<", "T", ">", "BigInteger", "sumOfBigInteger", "(", "Iterable", "<", "T", ">", "iterable", ",", "Function", "<", "?", "super", "T", ",", "BigInteger", ">", "function", ")", "{", "if", "(", "iterable", "instanceof", "List", ")", "{", ...
Returns the BigInteger sum of the result of applying the function to each element of the iterable. @since 6.0
[ "Returns", "the", "BigInteger", "sum", "of", "the", "result", "of", "applying", "the", "function", "to", "each", "element", "of", "the", "iterable", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L2635-L2646
116,512
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/Iterate.java
Iterate.anySatisfy
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
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...
[ "public", "static", "<", "T", ">", "boolean", "anySatisfy", "(", "Iterable", "<", "T", ">", "iterable", ",", "Predicate", "<", "?", "super", "T", ">", "predicate", ")", "{", "if", "(", "iterable", "instanceof", "RichIterable", ")", "{", "return", "(", ...
Returns true if the predicate evaluates to true for any element of the iterable. Returns false if the iterable is empty or if no elements return true for the predicate.
[ "Returns", "true", "if", "the", "predicate", "evaluates", "to", "true", "for", "any", "element", "of", "the", "iterable", ".", "Returns", "false", "if", "the", "iterable", "is", "empty", "or", "if", "no", "elements", "return", "true", "for", "the", "predic...
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L2796-L2815
116,513
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/Iterate.java
Iterate.toMap
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
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; }
[ "public", "static", "<", "T", ",", "K", ">", "MutableMap", "<", "K", ",", "T", ">", "toMap", "(", "Iterable", "<", "T", ">", "iterable", ",", "Function", "<", "?", "super", "T", ",", "?", "extends", "K", ">", "keyFunction", ")", "{", "MutableMap", ...
Iterate over the specified collection applying the specified Function to each element to calculate a key and return the results as a Map.
[ "Iterate", "over", "the", "specified", "collection", "applying", "the", "specified", "Function", "to", "each", "element", "to", "calculate", "a", "key", "and", "return", "the", "results", "as", "a", "Map", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L2954-L2961
116,514
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/Iterate.java
Iterate.toMap
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
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()); }
[ "public", "static", "<", "T", ",", "K", ",", "V", ">", "MutableMap", "<", "K", ",", "V", ">", "toMap", "(", "Iterable", "<", "T", ">", "iterable", ",", "Function", "<", "?", "super", "T", ",", "?", "extends", "K", ">", "keyFunction", ",", "Functi...
Iterate over the specified collection applying the specified Functions to each element to calculate a key and value, and return the results as a Map.
[ "Iterate", "over", "the", "specified", "collection", "applying", "the", "specified", "Functions", "to", "each", "element", "to", "calculate", "a", "key", "and", "value", "and", "return", "the", "results", "as", "a", "Map", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L2967-L2973
116,515
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/Iterate.java
Iterate.addToMap
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
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; }
[ "public", "static", "<", "T", ",", "K", ",", "V", ",", "M", "extends", "Map", "<", "K", ",", "V", ">", ">", "M", "addToMap", "(", "Iterable", "<", "T", ">", "iterable", ",", "Function", "<", "?", "super", "T", ",", "?", "extends", "K", ">", "...
Iterate over the specified collection applying a specific Function to each element to calculate a key, and add the results to input Map. This method will mutate the input Map.
[ "Iterate", "over", "the", "specified", "collection", "applying", "a", "specific", "Function", "to", "each", "element", "to", "calculate", "a", "key", "and", "add", "the", "results", "to", "input", "Map", ".", "This", "method", "will", "mutate", "the", "input...
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L2980-L2987
116,516
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/Iterate.java
Iterate.toSortedList
public static <T extends Comparable<? super T>> MutableList<T> toSortedList(Iterable<T> iterable) { return Iterate.toSortedList(iterable, Comparators.naturalOrder()); }
java
public static <T extends Comparable<? super T>> MutableList<T> toSortedList(Iterable<T> iterable) { return Iterate.toSortedList(iterable, Comparators.naturalOrder()); }
[ "public", "static", "<", "T", "extends", "Comparable", "<", "?", "super", "T", ">", ">", "MutableList", "<", "T", ">", "toSortedList", "(", "Iterable", "<", "T", ">", "iterable", ")", "{", "return", "Iterate", ".", "toSortedList", "(", "iterable", ",", ...
Return the specified collection as a sorted List.
[ "Return", "the", "specified", "collection", "as", "a", "sorted", "List", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L3007-L3010
116,517
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/Iterate.java
Iterate.toSortedList
public static <T> MutableList<T> toSortedList(Iterable<T> iterable, Comparator<? super T> comparator) { return FastList.newList(iterable).sortThis(comparator); }
java
public static <T> MutableList<T> toSortedList(Iterable<T> iterable, Comparator<? super T> comparator) { return FastList.newList(iterable).sortThis(comparator); }
[ "public", "static", "<", "T", ">", "MutableList", "<", "T", ">", "toSortedList", "(", "Iterable", "<", "T", ">", "iterable", ",", "Comparator", "<", "?", "super", "T", ">", "comparator", ")", "{", "return", "FastList", ".", "newList", "(", "iterable", ...
Return the specified collection as a sorted List using the specified Comparator.
[ "Return", "the", "specified", "collection", "as", "a", "sorted", "List", "using", "the", "specified", "Comparator", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L3015-L3018
116,518
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/Iterate.java
Iterate.sizeOf
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
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...
[ "public", "static", "int", "sizeOf", "(", "Iterable", "<", "?", ">", "iterable", ")", "{", "if", "(", "iterable", "instanceof", "Collection", ")", "{", "return", "(", "(", "Collection", "<", "?", ">", ")", "iterable", ")", ".", "size", "(", ")", ";",...
Returns the size of an iterable. In the case of Collections and RichIterables, the method size is called. All other iterables will force a complete iteration to happen, which can be unnecessarily costly.
[ "Returns", "the", "size", "of", "an", "iterable", ".", "In", "the", "case", "of", "Collections", "and", "RichIterables", "the", "method", "size", "is", "called", ".", "All", "other", "iterables", "will", "force", "a", "complete", "iteration", "to", "happen",...
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L3025-L3036
116,519
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/Iterate.java
Iterate.contains
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
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);...
[ "public", "static", "boolean", "contains", "(", "Iterable", "<", "?", ">", "iterable", ",", "Object", "value", ")", "{", "if", "(", "iterable", "instanceof", "Collection", ")", "{", "return", "(", "(", "Collection", "<", "?", ">", ")", "iterable", ")", ...
Returns true if the iterable contains the value. In the case of Collections and RichIterables, the method contains is called. All other iterables will force a complete iteration to happen, which can be unnecessarily costly.
[ "Returns", "true", "if", "the", "iterable", "contains", "the", "value", ".", "In", "the", "case", "of", "Collections", "and", "RichIterables", "the", "method", "contains", "is", "called", ".", "All", "other", "iterables", "will", "force", "a", "complete", "i...
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L3043-L3054
116,520
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/Iterate.java
Iterate.toArray
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
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...
[ "public", "static", "<", "T", ">", "Object", "[", "]", "toArray", "(", "Iterable", "<", "T", ">", "iterable", ")", "{", "if", "(", "iterable", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", ")", ";", "}", "if", "(", "iterable", ...
Converts the specified iterable to an array.
[ "Converts", "the", "specified", "iterable", "to", "an", "array", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L3059-L3076
116,521
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/Iterate.java
Iterate.toArray
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
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...
[ "public", "static", "<", "T", ">", "T", "[", "]", "toArray", "(", "Iterable", "<", "?", "extends", "T", ">", "iterable", ",", "T", "[", "]", "target", ")", "{", "if", "(", "iterable", "instanceof", "Collection", ")", "{", "return", "(", "(", "Colle...
Copies the specified iterable into the specified array.
[ "Copies", "the", "specified", "iterable", "into", "the", "specified", "array", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L3081-L3094
116,522
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/Iterate.java
Iterate.maxBy
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
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) { ...
[ "public", "static", "<", "T", ",", "V", "extends", "Comparable", "<", "?", "super", "V", ">", ">", "T", "maxBy", "(", "Iterable", "<", "T", ">", "iterable", ",", "Function", "<", "?", "super", "T", ",", "?", "extends", "V", ">", "function", ")", ...
Returns the maximum element out of the iterable based on the natural order of the attribute returned by the function.
[ "Returns", "the", "maximum", "element", "out", "of", "the", "iterable", "based", "on", "the", "natural", "order", "of", "the", "attribute", "returned", "by", "the", "function", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L3546-L3561
116,523
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/internal/ReflectionHelper.java
ReflectionHelper.getConstructor
public static <T> Constructor<T> getConstructor(Class<T> instantiable, Class<?>... constructorParameterTypes) { try { return instantiable.getConstructor(constructorParameterTypes); } catch (NoSuchMethodException ignored) { return ReflectionHelper.searc...
java
public static <T> Constructor<T> getConstructor(Class<T> instantiable, Class<?>... constructorParameterTypes) { try { return instantiable.getConstructor(constructorParameterTypes); } catch (NoSuchMethodException ignored) { return ReflectionHelper.searc...
[ "public", "static", "<", "T", ">", "Constructor", "<", "T", ">", "getConstructor", "(", "Class", "<", "T", ">", "instantiable", ",", "Class", "<", "?", ">", "...", "constructorParameterTypes", ")", "{", "try", "{", "return", "instantiable", ".", "getConstr...
These are special methods that will not produce error messages if the getter method is not found
[ "These", "are", "special", "methods", "that", "will", "not", "produce", "error", "messages", "if", "the", "getter", "method", "is", "not", "found" ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/internal/ReflectionHelper.java#L62-L72
116,524
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/list/Interval.java
Interval.oneToBy
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
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); }
[ "public", "static", "Interval", "oneToBy", "(", "int", "count", ",", "int", "step", ")", "{", "if", "(", "count", "<", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Only positive ranges allowed using oneToBy\"", ")", ";", "}", "return", "I...
Returns an Interval starting from 1 to the specified count value with a step value of step.
[ "Returns", "an", "Interval", "starting", "from", "1", "to", "the", "specified", "count", "value", "with", "a", "step", "value", "of", "step", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/list/Interval.java#L148-L155
116,525
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/list/Interval.java
Interval.fromTo
public static Interval fromTo(int from, int to) { if (from <= to) { return Interval.fromToBy(from, to, 1); } return Interval.fromToBy(from, to, -1); }
java
public static Interval fromTo(int from, int to) { if (from <= to) { return Interval.fromToBy(from, to, 1); } return Interval.fromToBy(from, to, -1); }
[ "public", "static", "Interval", "fromTo", "(", "int", "from", ",", "int", "to", ")", "{", "if", "(", "from", "<=", "to", ")", "{", "return", "Interval", ".", "fromToBy", "(", "from", ",", "to", ",", "1", ")", ";", "}", "return", "Interval", ".", ...
Returns an Interval starting from the value from to the specified value to with a step value of 1.
[ "Returns", "an", "Interval", "starting", "from", "the", "value", "from", "to", "the", "specified", "value", "to", "with", "a", "step", "value", "of", "1", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/list/Interval.java#L176-L183
116,526
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/list/Interval.java
Interval.evensFromTo
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
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) ...
[ "public", "static", "Interval", "evensFromTo", "(", "int", "from", ",", "int", "to", ")", "{", "if", "(", "from", "%", "2", "!=", "0", ")", "{", "if", "(", "from", "<", "to", ")", "{", "from", "++", ";", "}", "else", "{", "from", "--", ";", "...
Returns an Interval representing the even values from the value from to the value to.
[ "Returns", "an", "Interval", "representing", "the", "even", "values", "from", "the", "value", "from", "to", "the", "value", "to", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/list/Interval.java#L188-L213
116,527
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/list/Interval.java
Interval.oddsFromTo
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
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) ...
[ "public", "static", "Interval", "oddsFromTo", "(", "int", "from", ",", "int", "to", ")", "{", "if", "(", "from", "%", "2", "==", "0", ")", "{", "if", "(", "from", "<", "to", ")", "{", "from", "++", ";", "}", "else", "{", "from", "--", ";", "}...
Returns an Interval representing the odd values from the value from to the value to.
[ "Returns", "an", "Interval", "representing", "the", "odd", "values", "from", "the", "value", "from", "to", "the", "value", "to", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/list/Interval.java#L218-L243
116,528
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/list/Interval.java
Interval.toSet
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
public static MutableSet<Integer> toSet(int from, int to) { MutableSet<Integer> targetCollection = UnifiedSet.newSet(); Interval.fromTo(from, to).forEach(CollectionAddProcedure.on(targetCollection)); return targetCollection; }
[ "public", "static", "MutableSet", "<", "Integer", ">", "toSet", "(", "int", "from", ",", "int", "to", ")", "{", "MutableSet", "<", "Integer", ">", "targetCollection", "=", "UnifiedSet", ".", "newSet", "(", ")", ";", "Interval", ".", "fromTo", "(", "from"...
Returns an Set representing the Integer values from the value from to the value to.
[ "Returns", "an", "Set", "representing", "the", "Integer", "values", "from", "the", "value", "from", "to", "the", "value", "to", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/list/Interval.java#L248-L253
116,529
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/list/Interval.java
Interval.toReverseList
public static MutableList<Integer> toReverseList(int from, int to) { return Interval.fromTo(from, to).reverseThis().toList(); }
java
public static MutableList<Integer> toReverseList(int from, int to) { return Interval.fromTo(from, to).reverseThis().toList(); }
[ "public", "static", "MutableList", "<", "Integer", ">", "toReverseList", "(", "int", "from", ",", "int", "to", ")", "{", "return", "Interval", ".", "fromTo", "(", "from", ",", "to", ")", ".", "reverseThis", "(", ")", ".", "toList", "(", ")", ";", "}"...
Returns a MutableList representing the Integer values from the value from to the value to in reverse.
[ "Returns", "a", "MutableList", "representing", "the", "Integer", "values", "from", "the", "value", "from", "to", "the", "value", "to", "in", "reverse", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/list/Interval.java#L258-L261
116,530
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/list/Interval.java
Interval.fromToBy
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
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 ...
[ "public", "static", "Interval", "fromToBy", "(", "int", "from", ",", "int", "to", ",", "int", "stepBy", ")", "{", "if", "(", "stepBy", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Cannot use a step by of 0\"", ")", ";", "}", "if...
Returns an Interval for the range of integers inclusively between from and to with the specified stepBy value.
[ "Returns", "an", "Interval", "for", "the", "range", "of", "integers", "inclusively", "between", "from", "and", "to", "with", "the", "specified", "stepBy", "value", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/list/Interval.java#L280-L291
116,531
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/list/Interval.java
Interval.bigIntegerProduct
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
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())); ...
[ "private", "BigInteger", "bigIntegerProduct", "(", ")", "{", "return", "this", ".", "injectInto", "(", "BigInteger", ".", "valueOf", "(", "1L", ")", ",", "new", "Function2", "<", "BigInteger", ",", "Integer", ",", "BigInteger", ">", "(", ")", "{", "public"...
Returns the BigInteger result of calculating product for the range.
[ "Returns", "the", "BigInteger", "result", "of", "calculating", "product", "for", "the", "range", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/list/Interval.java#L363-L372
116,532
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/list/Interval.java
Interval.forEach
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
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...
[ "public", "void", "forEach", "(", "Procedure", "<", "?", "super", "Integer", ">", "procedure", ",", "Executor", "executor", ")", "{", "CountDownLatch", "latch", "=", "new", "CountDownLatch", "(", "this", ".", "size", "(", ")", ")", ";", "if", "(", "this"...
This method executes a void procedure against an executor, passing the current index of the interval.
[ "This", "method", "executes", "a", "void", "procedure", "against", "an", "executor", "passing", "the", "current", "index", "of", "the", "interval", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/list/Interval.java#L481-L508
116,533
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/list/Interval.java
Interval.run
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
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) { ...
[ "public", "void", "run", "(", "Runnable", "runnable", ")", "{", "if", "(", "this", ".", "goForward", "(", ")", ")", "{", "for", "(", "int", "i", "=", "this", ".", "from", ";", "i", "<=", "this", ".", "to", ";", "i", "+=", "this", ".", "step", ...
This method runs a runnable a specified number of times against on the current thread.
[ "This", "method", "runs", "a", "runnable", "a", "specified", "number", "of", "times", "against", "on", "the", "current", "thread", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/list/Interval.java#L535-L551
116,534
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/list/Interval.java
Interval.run
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
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;...
[ "public", "void", "run", "(", "Runnable", "runnable", ",", "Executor", "executor", ")", "{", "if", "(", "this", ".", "goForward", "(", ")", ")", "{", "for", "(", "int", "i", "=", "this", ".", "from", ";", "i", "<=", "this", ".", "to", ";", "i", ...
This method runs a runnable a specified number of times against an executor. The method is effectively asynchronous because it does not wait for all of the runnables to finish.
[ "This", "method", "runs", "a", "runnable", "a", "specified", "number", "of", "times", "against", "an", "executor", ".", "The", "method", "is", "effectively", "asynchronous", "because", "it", "does", "not", "wait", "for", "all", "of", "the", "runnables", "to"...
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/list/Interval.java#L557-L573
116,535
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/list/Interval.java
Interval.toIntArray
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
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; }
[ "public", "int", "[", "]", "toIntArray", "(", ")", "{", "final", "int", "[", "]", "result", "=", "new", "int", "[", "this", ".", "size", "(", ")", "]", ";", "this", ".", "forEachWithIndex", "(", "new", "IntIntProcedure", "(", ")", "{", "public", "v...
Converts the interval to an Integer array
[ "Converts", "the", "interval", "to", "an", "Integer", "array" ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/list/Interval.java#L808-L819
116,536
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/MapIterate.java
MapIterate.ifPresentApply
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
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(...
[ "public", "static", "<", "K", ",", "V", ",", "A", ">", "A", "ifPresentApply", "(", "Map", "<", "K", ",", "V", ">", "map", ",", "K", "key", ",", "Function", "<", "?", "super", "V", ",", "?", "extends", "A", ">", "function", ")", "{", "if", "("...
If there is a value in the Map tat the specified key, return the result of applying the specified Function on the value, otherwise return null.
[ "If", "there", "is", "a", "value", "in", "the", "Map", "tat", "the", "specified", "key", "return", "the", "result", "of", "applying", "the", "specified", "Function", "on", "the", "value", "otherwise", "return", "null", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/MapIterate.java#L235-L246
116,537
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/MapIterate.java
MapIterate.collect
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
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())); }
[ "public", "static", "<", "K", ",", "V", ",", "K2", ",", "V2", ">", "MutableMap", "<", "K2", ",", "V2", ">", "collect", "(", "Map", "<", "K", ",", "V", ">", "map", ",", "Function2", "<", "?", "super", "K", ",", "?", "super", "V", ",", "Pair", ...
For each value of the map, the function is evaluated with the key and value as the parameter. The results of these evaluations are collected into a new UnifiedMap.
[ "For", "each", "value", "of", "the", "map", "the", "function", "is", "evaluated", "with", "the", "key", "and", "value", "as", "the", "parameter", ".", "The", "results", "of", "these", "evaluations", "are", "collected", "into", "a", "new", "UnifiedMap", "."...
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/MapIterate.java#L626-L631
116,538
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/MapIterate.java
MapIterate.collect
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
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 ...
[ "public", "static", "<", "K1", ",", "V1", ",", "K2", ",", "V2", ",", "R", "extends", "Map", "<", "K2", ",", "V2", ">", ">", "R", "collect", "(", "Map", "<", "K1", ",", "V1", ">", "map", ",", "final", "Function2", "<", "?", "super", "K1", ",",...
For each value of the map, the function is evaluated with the key and value as the parameter. The results of these evaluations are collected into the target map.
[ "For", "each", "value", "of", "the", "map", "the", "function", "is", "evaluated", "with", "the", "key", "and", "value", "as", "the", "parameter", ".", "The", "results", "of", "these", "evaluations", "are", "collected", "into", "the", "target", "map", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/MapIterate.java#L637-L651
116,539
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/MapIterate.java
MapIterate.collect
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
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()); }
[ "public", "static", "<", "K1", ",", "V1", ",", "K2", ",", "V2", ">", "MutableMap", "<", "K2", ",", "V2", ">", "collect", "(", "Map", "<", "K1", ",", "V1", ">", "map", ",", "Function", "<", "?", "super", "K1", ",", "?", "extends", "K2", ">", "...
For each key-value entry of a map, applies a function to each, and adds the transformed entry to a new Map.
[ "For", "each", "key", "-", "value", "entry", "of", "a", "map", "applies", "a", "function", "to", "each", "and", "adds", "the", "transformed", "entry", "to", "a", "new", "Map", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/MapIterate.java#L728-L734
116,540
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/MapIterate.java
MapIterate.collect
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
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,...
[ "public", "static", "<", "K1", ",", "V1", ",", "K2", ",", "V2", ">", "MutableMap", "<", "K2", ",", "V2", ">", "collect", "(", "Map", "<", "K1", ",", "V1", ">", "map", ",", "final", "Function", "<", "?", "super", "K1", ",", "?", "extends", "K2",...
For each key-value entry of a map, applies a function to each, and adds the transformed entry to the target Map.
[ "For", "each", "key", "-", "value", "entry", "of", "a", "map", "applies", "a", "function", "to", "each", "and", "adds", "the", "transformed", "entry", "to", "the", "target", "Map", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/MapIterate.java#L739-L752
116,541
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/MapIterate.java
MapIterate.toListOfPairs
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
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...
[ "public", "static", "<", "K", ",", "V", ">", "MutableList", "<", "Pair", "<", "K", ",", "V", ">", ">", "toListOfPairs", "(", "Map", "<", "K", ",", "V", ">", "map", ")", "{", "final", "MutableList", "<", "Pair", "<", "K", ",", "V", ">", ">", "...
Iterate over the specified map applying the specified Function to each value and return the results as a List.
[ "Iterate", "over", "the", "specified", "map", "applying", "the", "specified", "Function", "to", "each", "value", "and", "return", "the", "results", "as", "a", "List", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/MapIterate.java#L977-L988
116,542
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/MapIterate.java
MapIterate.toSortedList
public static <K, V> MutableList<V> toSortedList( Map<K, V> map, Comparator<? super V> comparator) { return Iterate.toSortedList(map.values(), comparator); }
java
public static <K, V> MutableList<V> toSortedList( Map<K, V> map, Comparator<? super V> comparator) { return Iterate.toSortedList(map.values(), comparator); }
[ "public", "static", "<", "K", ",", "V", ">", "MutableList", "<", "V", ">", "toSortedList", "(", "Map", "<", "K", ",", "V", ">", "map", ",", "Comparator", "<", "?", "super", "V", ">", "comparator", ")", "{", "return", "Iterate", ".", "toSortedList", ...
Iterate over the specified map applying the specified Function to each value and return the results as a sorted List using the specified Comparator.
[ "Iterate", "over", "the", "specified", "map", "applying", "the", "specified", "Function", "to", "each", "value", "and", "return", "the", "results", "as", "a", "sorted", "List", "using", "the", "specified", "Comparator", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/MapIterate.java#L994-L999
116,543
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/MapIterate.java
MapIterate.occurrencesOf
public static <K, V> int occurrencesOf(Map<K, V> map, V object) { return Iterate.count(map.values(), Predicates.equal(object)); }
java
public static <K, V> int occurrencesOf(Map<K, V> map, V object) { return Iterate.count(map.values(), Predicates.equal(object)); }
[ "public", "static", "<", "K", ",", "V", ">", "int", "occurrencesOf", "(", "Map", "<", "K", ",", "V", ">", "map", ",", "V", "object", ")", "{", "return", "Iterate", ".", "count", "(", "map", ".", "values", "(", ")", ",", "Predicates", ".", "equal"...
Return the number of occurrences of object in the specified map.
[ "Return", "the", "number", "of", "occurrences", "of", "object", "in", "the", "specified", "map", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/MapIterate.java#L1022-L1025
116,544
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/MapIterate.java
MapIterate.occurrencesOfAttribute
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
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)); }
[ "public", "static", "<", "K", ",", "V", ",", "A", ">", "int", "occurrencesOfAttribute", "(", "Map", "<", "K", ",", "V", ">", "map", ",", "Function", "<", "?", "super", "V", ",", "?", "extends", "A", ">", "function", ",", "A", "object", ")", "{", ...
Return the number of occurrences where object is equal to the specified attribute in the specified map.
[ "Return", "the", "number", "of", "occurrences", "where", "object", "is", "equal", "to", "the", "specified", "attribute", "in", "the", "specified", "map", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/MapIterate.java#L1030-L1036
116,545
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/set/sorted/mutable/SynchronizedSortedSet.java
SynchronizedSortedSet.of
public static <E, S extends SortedSet<E>> SynchronizedSortedSet<E> of(S set) { return new SynchronizedSortedSet<E>(SortedSetAdapter.adapt(set)); }
java
public static <E, S extends SortedSet<E>> SynchronizedSortedSet<E> of(S set) { return new SynchronizedSortedSet<E>(SortedSetAdapter.adapt(set)); }
[ "public", "static", "<", "E", ",", "S", "extends", "SortedSet", "<", "E", ">", ">", "SynchronizedSortedSet", "<", "E", ">", "of", "(", "S", "set", ")", "{", "return", "new", "SynchronizedSortedSet", "<", "E", ">", "(", "SortedSetAdapter", ".", "adapt", ...
This method will take a MutableSortedSet and wrap it directly in a SynchronizedSortedSet. It will take any other non-GS-collection and first adapt it will a SortedSetAdapter, and then return a SynchronizedSortedSet that wraps the adapter.
[ "This", "method", "will", "take", "a", "MutableSortedSet", "and", "wrap", "it", "directly", "in", "a", "SynchronizedSortedSet", ".", "It", "will", "take", "any", "other", "non", "-", "GS", "-", "collection", "and", "first", "adapt", "it", "will", "a", "Sor...
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/set/sorted/mutable/SynchronizedSortedSet.java#L97-L100
116,546
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/set/sorted/mutable/SynchronizedSortedSet.java
SynchronizedSortedSet.of
public static <E, S extends SortedSet<E>> MutableSortedSet<E> of(S set, Object lock) { return new SynchronizedSortedSet<E>(SortedSetAdapter.adapt(set), lock); }
java
public static <E, S extends SortedSet<E>> MutableSortedSet<E> of(S set, Object lock) { return new SynchronizedSortedSet<E>(SortedSetAdapter.adapt(set), lock); }
[ "public", "static", "<", "E", ",", "S", "extends", "SortedSet", "<", "E", ">", ">", "MutableSortedSet", "<", "E", ">", "of", "(", "S", "set", ",", "Object", "lock", ")", "{", "return", "new", "SynchronizedSortedSet", "<", "E", ">", "(", "SortedSetAdapt...
This method will take a MutableSortedSet and wrap it directly in a SynchronizedSortedSet. It will take any other non-GS-collection and first adapt it will a SortedSetAdapter, and then return a SynchronizedSortedSet that wraps the adapter. Additionally, a developer specifies which lock to use with the collection.
[ "This", "method", "will", "take", "a", "MutableSortedSet", "and", "wrap", "it", "directly", "in", "a", "SynchronizedSortedSet", ".", "It", "will", "take", "any", "other", "non", "-", "GS", "-", "collection", "and", "first", "adapt", "it", "will", "a", "Sor...
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/set/sorted/mutable/SynchronizedSortedSet.java#L108-L111
116,547
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/bag/sorted/mutable/UnmodifiableSortedBag.java
UnmodifiableSortedBag.of
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
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); }
[ "public", "static", "<", "E", ",", "S", "extends", "MutableSortedBag", "<", "E", ">", ">", "UnmodifiableSortedBag", "<", "E", ">", "of", "(", "S", "bag", ")", "{", "if", "(", "bag", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(...
This method will take a MutableSortedBag and wrap it directly in a UnmodifiableSortedBag.
[ "This", "method", "will", "take", "a", "MutableSortedBag", "and", "wrap", "it", "directly", "in", "a", "UnmodifiableSortedBag", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/bag/sorted/mutable/UnmodifiableSortedBag.java#L80-L87
116,548
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/set/mutable/SynchronizedMutableSet.java
SynchronizedMutableSet.of
public static <E, S extends Set<E>> SynchronizedMutableSet<E> of(S set) { return new SynchronizedMutableSet<E>(SetAdapter.adapt(set)); }
java
public static <E, S extends Set<E>> SynchronizedMutableSet<E> of(S set) { return new SynchronizedMutableSet<E>(SetAdapter.adapt(set)); }
[ "public", "static", "<", "E", ",", "S", "extends", "Set", "<", "E", ">", ">", "SynchronizedMutableSet", "<", "E", ">", "of", "(", "S", "set", ")", "{", "return", "new", "SynchronizedMutableSet", "<", "E", ">", "(", "SetAdapter", ".", "adapt", "(", "s...
This method will take a MutableSet and wrap it directly in a SynchronizedMutableSet. It will take any other non-GS-collection and first adapt it will a SetAdapter, and then return a SynchronizedMutableSet that wraps the adapter.
[ "This", "method", "will", "take", "a", "MutableSet", "and", "wrap", "it", "directly", "in", "a", "SynchronizedMutableSet", ".", "It", "will", "take", "any", "other", "non", "-", "GS", "-", "collection", "and", "first", "adapt", "it", "will", "a", "SetAdapt...
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/set/mutable/SynchronizedMutableSet.java#L91-L94
116,549
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/map/mutable/UnmodifiableMutableMap.java
UnmodifiableMutableMap.of
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
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)); }
[ "public", "static", "<", "K", ",", "V", ",", "M", "extends", "Map", "<", "K", ",", "V", ">", ">", "UnmodifiableMutableMap", "<", "K", ",", "V", ">", "of", "(", "M", "map", ")", "{", "if", "(", "map", "==", "null", ")", "{", "throw", "new", "I...
This method will take a MutableMap and wrap it directly in a UnmodifiableMutableMap. It will take any other non-GS-map and first adapt it will a MapAdapter, and then return a UnmodifiableMutableMap that wraps the adapter.
[ "This", "method", "will", "take", "a", "MutableMap", "and", "wrap", "it", "directly", "in", "a", "UnmodifiableMutableMap", ".", "It", "will", "take", "any", "other", "non", "-", "GS", "-", "map", "and", "first", "adapt", "it", "will", "a", "MapAdapter", ...
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/map/mutable/UnmodifiableMutableMap.java#L105-L112
116,550
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/set/sorted/mutable/UnmodifiableSortedSet.java
UnmodifiableSortedSet.of
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
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)); }
[ "public", "static", "<", "E", ",", "S", "extends", "SortedSet", "<", "E", ">", ">", "UnmodifiableSortedSet", "<", "E", ">", "of", "(", "S", "set", ")", "{", "if", "(", "set", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\...
This method will take a MutableSortedSet and wrap it directly in a UnmodifiableSortedSet. It will take any other non-GS-SortedSet and first adapt it will a SortedSetAdapter, and then return a UnmodifiableSortedSet that wraps the adapter.
[ "This", "method", "will", "take", "a", "MutableSortedSet", "and", "wrap", "it", "directly", "in", "a", "UnmodifiableSortedSet", ".", "It", "will", "take", "any", "other", "non", "-", "GS", "-", "SortedSet", "and", "first", "adapt", "it", "will", "a", "Sort...
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/set/sorted/mutable/UnmodifiableSortedSet.java#L83-L90
116,551
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/set/mutable/UnmodifiableMutableSet.java
UnmodifiableMutableSet.of
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
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)); }
[ "public", "static", "<", "E", ",", "S", "extends", "Set", "<", "E", ">", ">", "UnmodifiableMutableSet", "<", "E", ">", "of", "(", "S", "set", ")", "{", "if", "(", "set", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"cann...
This method will take a MutableSet and wrap it directly in a UnmodifiableMutableSet. It will take any other non-GS-set and first adapt it will a SetAdapter, and then return a UnmodifiableMutableSet that wraps the adapter.
[ "This", "method", "will", "take", "a", "MutableSet", "and", "wrap", "it", "directly", "in", "a", "UnmodifiableMutableSet", ".", "It", "will", "take", "any", "other", "non", "-", "GS", "-", "set", "and", "first", "adapt", "it", "will", "a", "SetAdapter", ...
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/set/mutable/UnmodifiableMutableSet.java#L78-L85
116,552
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/block/factory/Comparators.java
Comparators.byFirstOfPair
public static <T> SerializableComparator<Pair<T, ?>> byFirstOfPair(Comparator<? super T> comparator) { return new ByFirstOfPairComparator<T>(comparator); }
java
public static <T> SerializableComparator<Pair<T, ?>> byFirstOfPair(Comparator<? super T> comparator) { return new ByFirstOfPairComparator<T>(comparator); }
[ "public", "static", "<", "T", ">", "SerializableComparator", "<", "Pair", "<", "T", ",", "?", ">", ">", "byFirstOfPair", "(", "Comparator", "<", "?", "super", "T", ">", "comparator", ")", "{", "return", "new", "ByFirstOfPairComparator", "<", "T", ">", "(...
Creates a comparator for pairs by using an existing comparator that only compares the first element of the pair @param comparator original comparator that compares the first element of the pair @return A comparator that compares pairs only by their first element
[ "Creates", "a", "comparator", "for", "pairs", "by", "using", "an", "existing", "comparator", "that", "only", "compares", "the", "first", "element", "of", "the", "pair" ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/block/factory/Comparators.java#L145-L148
116,553
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/block/factory/Comparators.java
Comparators.bySecondOfPair
public static <T> SerializableComparator<Pair<?, T>> bySecondOfPair(Comparator<? super T> comparator) { return new BySecondOfPairComparator<T>(comparator); }
java
public static <T> SerializableComparator<Pair<?, T>> bySecondOfPair(Comparator<? super T> comparator) { return new BySecondOfPairComparator<T>(comparator); }
[ "public", "static", "<", "T", ">", "SerializableComparator", "<", "Pair", "<", "?", ",", "T", ">", ">", "bySecondOfPair", "(", "Comparator", "<", "?", "super", "T", ">", "comparator", ")", "{", "return", "new", "BySecondOfPairComparator", "<", "T", ">", ...
Creates a comparator for pairs by using an existing comparator that only compares the second element of the pair @param comparator original comparator that compares the second element of the pair @return A comparator that compares pairs only by their second element
[ "Creates", "a", "comparator", "for", "pairs", "by", "using", "an", "existing", "comparator", "that", "only", "compares", "the", "second", "element", "of", "the", "pair" ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/block/factory/Comparators.java#L156-L159
116,554
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/ArrayListIterate.java
ArrayListIterate.reverseForEach
public static <T> void reverseForEach(ArrayList<T> list, Procedure<? super T> procedure) { if (!list.isEmpty()) { ArrayListIterate.forEach(list, list.size() - 1, 0, procedure); } }
java
public static <T> void reverseForEach(ArrayList<T> list, Procedure<? super T> procedure) { if (!list.isEmpty()) { ArrayListIterate.forEach(list, list.size() - 1, 0, procedure); } }
[ "public", "static", "<", "T", ">", "void", "reverseForEach", "(", "ArrayList", "<", "T", ">", "list", ",", "Procedure", "<", "?", "super", "T", ">", "procedure", ")", "{", "if", "(", "!", "list", ".", "isEmpty", "(", ")", ")", "{", "ArrayListIterate"...
Reverses over the List in reverse order executing the Procedure for each element
[ "Reverses", "over", "the", "List", "in", "reverse", "order", "executing", "the", "Procedure", "for", "each", "element" ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/ArrayListIterate.java#L783-L789
116,555
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/list/primitive/IntInterval.java
IntInterval.oneToBy
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
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); }
[ "public", "static", "IntInterval", "oneToBy", "(", "int", "count", ",", "int", "step", ")", "{", "if", "(", "count", "<", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Only positive ranges allowed using oneToBy\"", ")", ";", "}", "return", ...
Returns an IntInterval starting from 1 to the specified count value with a step value of step.
[ "Returns", "an", "IntInterval", "starting", "from", "1", "to", "the", "specified", "count", "value", "with", "a", "step", "value", "of", "step", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/list/primitive/IntInterval.java#L137-L144
116,556
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/list/primitive/IntInterval.java
IntInterval.fromTo
public static IntInterval fromTo(int from, int to) { if (from <= to) { return IntInterval.fromToBy(from, to, 1); } return IntInterval.fromToBy(from, to, -1); }
java
public static IntInterval fromTo(int from, int to) { if (from <= to) { return IntInterval.fromToBy(from, to, 1); } return IntInterval.fromToBy(from, to, -1); }
[ "public", "static", "IntInterval", "fromTo", "(", "int", "from", ",", "int", "to", ")", "{", "if", "(", "from", "<=", "to", ")", "{", "return", "IntInterval", ".", "fromToBy", "(", "from", ",", "to", ",", "1", ")", ";", "}", "return", "IntInterval", ...
Returns an IntInterval starting from the value from to the specified value to with a step value of 1.
[ "Returns", "an", "IntInterval", "starting", "from", "the", "value", "from", "to", "the", "specified", "value", "to", "with", "a", "step", "value", "of", "1", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/list/primitive/IntInterval.java#L165-L172
116,557
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/list/primitive/IntInterval.java
IntInterval.evensFromTo
public static IntInterval evensFromTo(int from, int to) { if (from % 2 != 0) { if (from < to) { from++; } else { from--; } } if (to % 2 != 0) { if (to > from) ...
java
public static IntInterval evensFromTo(int from, int to) { if (from % 2 != 0) { if (from < to) { from++; } else { from--; } } if (to % 2 != 0) { if (to > from) ...
[ "public", "static", "IntInterval", "evensFromTo", "(", "int", "from", ",", "int", "to", ")", "{", "if", "(", "from", "%", "2", "!=", "0", ")", "{", "if", "(", "from", "<", "to", ")", "{", "from", "++", ";", "}", "else", "{", "from", "--", ";", ...
Returns an IntInterval representing the even values from the value from to the value to.
[ "Returns", "an", "IntInterval", "representing", "the", "even", "values", "from", "the", "value", "from", "to", "the", "value", "to", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/list/primitive/IntInterval.java#L177-L202
116,558
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/list/primitive/IntInterval.java
IntInterval.oddsFromTo
public static IntInterval oddsFromTo(int from, int to) { if (from % 2 == 0) { if (from < to) { from++; } else { from--; } } if (to % 2 == 0) { if (to > from) ...
java
public static IntInterval oddsFromTo(int from, int to) { if (from % 2 == 0) { if (from < to) { from++; } else { from--; } } if (to % 2 == 0) { if (to > from) ...
[ "public", "static", "IntInterval", "oddsFromTo", "(", "int", "from", ",", "int", "to", ")", "{", "if", "(", "from", "%", "2", "==", "0", ")", "{", "if", "(", "from", "<", "to", ")", "{", "from", "++", ";", "}", "else", "{", "from", "--", ";", ...
Returns an IntInterval representing the odd values from the value from to the value to.
[ "Returns", "an", "IntInterval", "representing", "the", "odd", "values", "from", "the", "value", "from", "to", "the", "value", "to", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/list/primitive/IntInterval.java#L207-L232
116,559
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/list/primitive/IntInterval.java
IntInterval.fromToBy
public static IntInterval 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 ...
java
public static IntInterval 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 ...
[ "public", "static", "IntInterval", "fromToBy", "(", "int", "from", ",", "int", "to", ",", "int", "stepBy", ")", "{", "if", "(", "stepBy", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Cannot use a step by of 0\"", ")", ";", "}", ...
Returns an IntInterval for the range of integers inclusively between from and to with the specified stepBy value.
[ "Returns", "an", "IntInterval", "for", "the", "range", "of", "integers", "inclusively", "between", "from", "and", "to", "with", "the", "specified", "stepBy", "value", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/list/primitive/IntInterval.java#L238-L249
116,560
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/map/mutable/ConcurrentHashMapUnsafe.java
ConcurrentHashMapUnsafe.putIfAbsentGetIfPresent
public <P1, P2> V putIfAbsentGetIfPresent(K key, Function2<K, V, K> keyTransformer, Function3<P1, P2, K, V> factory, P1 param1, P2 param2) { int hash = this.hash(key); Object[] currentArray = this.table; V newValue = null; boolean createdValue = false; while (true) { ...
java
public <P1, P2> V putIfAbsentGetIfPresent(K key, Function2<K, V, K> keyTransformer, Function3<P1, P2, K, V> factory, P1 param1, P2 param2) { int hash = this.hash(key); Object[] currentArray = this.table; V newValue = null; boolean createdValue = false; while (true) { ...
[ "public", "<", "P1", ",", "P2", ">", "V", "putIfAbsentGetIfPresent", "(", "K", "key", ",", "Function2", "<", "K", ",", "V", ",", "K", ">", "keyTransformer", ",", "Function3", "<", "P1", ",", "P2", ",", "K", ",", "V", ">", "factory", ",", "P1", "p...
It puts an object into the map based on the key. It uses a copy of the key converted by transformer. @param key The "mutable" key, which has the same identity/hashcode as the inserted key, only during this call @param keyTransformer If the record is absent, the transformer will transform the "mutable" key i...
[ "It", "puts", "an", "object", "into", "the", "map", "based", "on", "the", "key", ".", "It", "uses", "a", "copy", "of", "the", "key", "converted", "by", "transformer", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/map/mutable/ConcurrentHashMapUnsafe.java#L624-L669
116,561
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/UnmodifiableRichIterable.java
UnmodifiableRichIterable.of
public static <E, RI extends RichIterable<E>> UnmodifiableRichIterable<E> of(RI iterable) { if (iterable == null) { throw new IllegalArgumentException("cannot create a UnmodifiableRichIterable for null"); } return new UnmodifiableRichIterable<E>(iterable); }
java
public static <E, RI extends RichIterable<E>> UnmodifiableRichIterable<E> of(RI iterable) { if (iterable == null) { throw new IllegalArgumentException("cannot create a UnmodifiableRichIterable for null"); } return new UnmodifiableRichIterable<E>(iterable); }
[ "public", "static", "<", "E", ",", "RI", "extends", "RichIterable", "<", "E", ">", ">", "UnmodifiableRichIterable", "<", "E", ">", "of", "(", "RI", "iterable", ")", "{", "if", "(", "iterable", "==", "null", ")", "{", "throw", "new", "IllegalArgumentExcep...
This method will take a RichIterable and wrap it directly in a UnmodifiableRichIterable.
[ "This", "method", "will", "take", "a", "RichIterable", "and", "wrap", "it", "directly", "in", "a", "UnmodifiableRichIterable", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/UnmodifiableRichIterable.java#L95-L102
116,562
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/block/factory/Predicates.java
Predicates.equal
public static Predicates<Object> equal(Object object) { if (object == null) { return Predicates.isNull(); } return new EqualPredicate(object); }
java
public static Predicates<Object> equal(Object object) { if (object == null) { return Predicates.isNull(); } return new EqualPredicate(object); }
[ "public", "static", "Predicates", "<", "Object", ">", "equal", "(", "Object", "object", ")", "{", "if", "(", "object", "==", "null", ")", "{", "return", "Predicates", ".", "isNull", "(", ")", ";", "}", "return", "new", "EqualPredicate", "(", "object", ...
Tests for equality.
[ "Tests", "for", "equality", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/block/factory/Predicates.java#L136-L143
116,563
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/block/factory/Predicates.java
Predicates.betweenInclusive
public static <T extends Comparable<? super T>> Predicates<T> betweenInclusive(T from, T to) { Predicates.failIfDifferentTypes(from, to); return new BetweenInclusive<T>(from, to); }
java
public static <T extends Comparable<? super T>> Predicates<T> betweenInclusive(T from, T to) { Predicates.failIfDifferentTypes(from, to); return new BetweenInclusive<T>(from, to); }
[ "public", "static", "<", "T", "extends", "Comparable", "<", "?", "super", "T", ">", ">", "Predicates", "<", "T", ">", "betweenInclusive", "(", "T", "from", ",", "T", "to", ")", "{", "Predicates", ".", "failIfDifferentTypes", "(", "from", ",", "to", ")"...
Creates a predicate which returns true if an object passed to accept method is within the range, inclusive of the from and to values.
[ "Creates", "a", "predicate", "which", "returns", "true", "if", "an", "object", "passed", "to", "accept", "method", "is", "within", "the", "range", "inclusive", "of", "the", "from", "and", "to", "values", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/block/factory/Predicates.java#L149-L153
116,564
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/block/factory/Predicates.java
Predicates.betweenExclusive
public static <T extends Comparable<? super T>> Predicates<T> betweenExclusive(T from, T to) { Predicates.failIfDifferentTypes(from, to); return new BetweenExclusive<T>(from, to); }
java
public static <T extends Comparable<? super T>> Predicates<T> betweenExclusive(T from, T to) { Predicates.failIfDifferentTypes(from, to); return new BetweenExclusive<T>(from, to); }
[ "public", "static", "<", "T", "extends", "Comparable", "<", "?", "super", "T", ">", ">", "Predicates", "<", "T", ">", "betweenExclusive", "(", "T", "from", ",", "T", "to", ")", "{", "Predicates", ".", "failIfDifferentTypes", "(", "from", ",", "to", ")"...
Creates a predicate which returns true if an object passed to accept method is within the range, exclusive of the from and to values.
[ "Creates", "a", "predicate", "which", "returns", "true", "if", "an", "object", "passed", "to", "accept", "method", "is", "within", "the", "range", "exclusive", "of", "the", "from", "and", "to", "values", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/block/factory/Predicates.java#L170-L174
116,565
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/block/factory/Predicates.java
Predicates.betweenInclusiveFrom
public static <T extends Comparable<? super T>> Predicates<T> betweenInclusiveFrom(T from, T to) { Predicates.failIfDifferentTypes(from, to); return new BetweenInclusiveFrom<T>(from, to); }
java
public static <T extends Comparable<? super T>> Predicates<T> betweenInclusiveFrom(T from, T to) { Predicates.failIfDifferentTypes(from, to); return new BetweenInclusiveFrom<T>(from, to); }
[ "public", "static", "<", "T", "extends", "Comparable", "<", "?", "super", "T", ">", ">", "Predicates", "<", "T", ">", "betweenInclusiveFrom", "(", "T", "from", ",", "T", "to", ")", "{", "Predicates", ".", "failIfDifferentTypes", "(", "from", ",", "to", ...
Creates a predicate which returns true if an object passed to accept method is within the range, inclusive of the from and exclusive from the to value.
[ "Creates", "a", "predicate", "which", "returns", "true", "if", "an", "object", "passed", "to", "accept", "method", "is", "within", "the", "range", "inclusive", "of", "the", "from", "and", "exclusive", "from", "the", "to", "value", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/block/factory/Predicates.java#L180-L184
116,566
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/block/factory/Predicates.java
Predicates.betweenInclusiveTo
public static <T extends Comparable<? super T>> Predicates<T> betweenInclusiveTo(T from, T to) { Predicates.failIfDifferentTypes(from, to); return new BetweenInclusiveTo<T>(from, to); }
java
public static <T extends Comparable<? super T>> Predicates<T> betweenInclusiveTo(T from, T to) { Predicates.failIfDifferentTypes(from, to); return new BetweenInclusiveTo<T>(from, to); }
[ "public", "static", "<", "T", "extends", "Comparable", "<", "?", "super", "T", ">", ">", "Predicates", "<", "T", ">", "betweenInclusiveTo", "(", "T", "from", ",", "T", "to", ")", "{", "Predicates", ".", "failIfDifferentTypes", "(", "from", ",", "to", "...
Creates a predicate which returns true if an object passed to accept method is within the range, exclusive of the from and inclusive of the to value.
[ "Creates", "a", "predicate", "which", "returns", "true", "if", "an", "object", "passed", "to", "accept", "method", "is", "within", "the", "range", "exclusive", "of", "the", "from", "and", "inclusive", "of", "the", "to", "value", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/block/factory/Predicates.java#L190-L194
116,567
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/block/factory/Predicates.java
Predicates.in
public static Predicates<Object> in(Iterable<?> iterable) { if (iterable instanceof SetIterable<?>) { return new InSetIterablePredicate((SetIterable<?>) iterable); } if (iterable instanceof Set<?>) { return new InSetPredicate((Set<?>) iterable); ...
java
public static Predicates<Object> in(Iterable<?> iterable) { if (iterable instanceof SetIterable<?>) { return new InSetIterablePredicate((SetIterable<?>) iterable); } if (iterable instanceof Set<?>) { return new InSetPredicate((Set<?>) iterable); ...
[ "public", "static", "Predicates", "<", "Object", ">", "in", "(", "Iterable", "<", "?", ">", "iterable", ")", "{", "if", "(", "iterable", "instanceof", "SetIterable", "<", "?", ">", ")", "{", "return", "new", "InSetIterablePredicate", "(", "(", "SetIterable...
Creates a predicate which returns true if an object passed to accept method is contained in the iterable.
[ "Creates", "a", "predicate", "which", "returns", "true", "if", "an", "object", "passed", "to", "accept", "method", "is", "contained", "in", "the", "iterable", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/block/factory/Predicates.java#L199-L214
116,568
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/block/factory/Predicates.java
Predicates.attributeIn
public static <T> Predicates<T> attributeIn( Function<? super T, ?> function, Iterable<?> iterable) { return new AttributePredicate<T, Object>(function, Predicates.in(iterable)); }
java
public static <T> Predicates<T> attributeIn( Function<? super T, ?> function, Iterable<?> iterable) { return new AttributePredicate<T, Object>(function, Predicates.in(iterable)); }
[ "public", "static", "<", "T", ">", "Predicates", "<", "T", ">", "attributeIn", "(", "Function", "<", "?", "super", "T", ",", "?", ">", "function", ",", "Iterable", "<", "?", ">", "iterable", ")", "{", "return", "new", "AttributePredicate", "<", "T", ...
Creates a predicate which returns true if an attribute selected from an object passed to accept method is contained in the iterable.
[ "Creates", "a", "predicate", "which", "returns", "true", "if", "an", "attribute", "selected", "from", "an", "object", "passed", "to", "accept", "method", "is", "contained", "in", "the", "iterable", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/block/factory/Predicates.java#L229-L234
116,569
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/block/factory/Predicates.java
Predicates.notIn
public static Predicates<Object> notIn(Iterable<?> iterable) { if (iterable instanceof SetIterable<?>) { return new NotInSetIterablePredicate((SetIterable<?>) iterable); } if (iterable instanceof Set<?>) { return new NotInSetPredicate((Set<?>) iterable...
java
public static Predicates<Object> notIn(Iterable<?> iterable) { if (iterable instanceof SetIterable<?>) { return new NotInSetIterablePredicate((SetIterable<?>) iterable); } if (iterable instanceof Set<?>) { return new NotInSetPredicate((Set<?>) iterable...
[ "public", "static", "Predicates", "<", "Object", ">", "notIn", "(", "Iterable", "<", "?", ">", "iterable", ")", "{", "if", "(", "iterable", "instanceof", "SetIterable", "<", "?", ">", ")", "{", "return", "new", "NotInSetIterablePredicate", "(", "(", "SetIt...
Creates a predicate which returns true if an object passed to accept method is not contained in the iterable.
[ "Creates", "a", "predicate", "which", "returns", "true", "if", "an", "object", "passed", "to", "accept", "method", "is", "not", "contained", "in", "the", "iterable", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/block/factory/Predicates.java#L272-L287
116,570
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/block/factory/Predicates.java
Predicates.attributeNotIn
public static <T> Predicates<T> attributeNotIn( Function<? super T, ?> function, Iterable<?> iterable) { return new AttributePredicate<T, Object>(function, Predicates.notIn(iterable)); }
java
public static <T> Predicates<T> attributeNotIn( Function<? super T, ?> function, Iterable<?> iterable) { return new AttributePredicate<T, Object>(function, Predicates.notIn(iterable)); }
[ "public", "static", "<", "T", ">", "Predicates", "<", "T", ">", "attributeNotIn", "(", "Function", "<", "?", "super", "T", ",", "?", ">", "function", ",", "Iterable", "<", "?", ">", "iterable", ")", "{", "return", "new", "AttributePredicate", "<", "T",...
Creates a predicate which returns true if an attribute selected from an object passed to accept method is not contained in the iterable.
[ "Creates", "a", "predicate", "which", "returns", "true", "if", "an", "attribute", "selected", "from", "an", "object", "passed", "to", "accept", "method", "is", "not", "contained", "in", "the", "iterable", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/block/factory/Predicates.java#L302-L307
116,571
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/LazyIterate.java
LazyIterate.adapt
public static <T> LazyIterable<T> adapt(Iterable<T> iterable) { return new LazyIterableAdapter<T>(iterable); }
java
public static <T> LazyIterable<T> adapt(Iterable<T> iterable) { return new LazyIterableAdapter<T>(iterable); }
[ "public", "static", "<", "T", ">", "LazyIterable", "<", "T", ">", "adapt", "(", "Iterable", "<", "T", ">", "iterable", ")", "{", "return", "new", "LazyIterableAdapter", "<", "T", ">", "(", "iterable", ")", ";", "}" ]
Creates a deferred rich iterable for the specified iterable
[ "Creates", "a", "deferred", "rich", "iterable", "for", "the", "specified", "iterable" ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/LazyIterate.java#L61-L64
116,572
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/LazyIterate.java
LazyIterate.select
public static <T> LazyIterable<T> select(Iterable<T> iterable, Predicate<? super T> predicate) { return new SelectIterable<T>(iterable, predicate); }
java
public static <T> LazyIterable<T> select(Iterable<T> iterable, Predicate<? super T> predicate) { return new SelectIterable<T>(iterable, predicate); }
[ "public", "static", "<", "T", ">", "LazyIterable", "<", "T", ">", "select", "(", "Iterable", "<", "T", ">", "iterable", ",", "Predicate", "<", "?", "super", "T", ">", "predicate", ")", "{", "return", "new", "SelectIterable", "<", "T", ">", "(", "iter...
Creates a deferred filtering iterable for the specified iterable
[ "Creates", "a", "deferred", "filtering", "iterable", "for", "the", "specified", "iterable" ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/LazyIterate.java#L69-L72
116,573
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/LazyIterate.java
LazyIterate.reject
public static <T> LazyIterable<T> reject(Iterable<T> iterable, Predicate<? super T> predicate) { return new RejectIterable<T>(iterable, predicate); }
java
public static <T> LazyIterable<T> reject(Iterable<T> iterable, Predicate<? super T> predicate) { return new RejectIterable<T>(iterable, predicate); }
[ "public", "static", "<", "T", ">", "LazyIterable", "<", "T", ">", "reject", "(", "Iterable", "<", "T", ">", "iterable", ",", "Predicate", "<", "?", "super", "T", ">", "predicate", ")", "{", "return", "new", "RejectIterable", "<", "T", ">", "(", "iter...
Creates a deferred negative filtering iterable for the specified iterable
[ "Creates", "a", "deferred", "negative", "filtering", "iterable", "for", "the", "specified", "iterable" ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/LazyIterate.java#L77-L80
116,574
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/LazyIterate.java
LazyIterate.collect
public static <T, V> LazyIterable<V> collect( Iterable<T> iterable, Function<? super T, ? extends V> function) { return new CollectIterable<T, V>(iterable, function); }
java
public static <T, V> LazyIterable<V> collect( Iterable<T> iterable, Function<? super T, ? extends V> function) { return new CollectIterable<T, V>(iterable, function); }
[ "public", "static", "<", "T", ",", "V", ">", "LazyIterable", "<", "V", ">", "collect", "(", "Iterable", "<", "T", ">", "iterable", ",", "Function", "<", "?", "super", "T", ",", "?", "extends", "V", ">", "function", ")", "{", "return", "new", "Colle...
Creates a deferred transforming iterable for the specified iterable
[ "Creates", "a", "deferred", "transforming", "iterable", "for", "the", "specified", "iterable" ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/LazyIterate.java#L90-L95
116,575
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/LazyIterate.java
LazyIterate.flatCollect
public static <T, V> LazyIterable<V> flatCollect( Iterable<T> iterable, Function<? super T, ? extends Iterable<V>> function) { return new FlatCollectIterable<T, V>(iterable, function); }
java
public static <T, V> LazyIterable<V> flatCollect( Iterable<T> iterable, Function<? super T, ? extends Iterable<V>> function) { return new FlatCollectIterable<T, V>(iterable, function); }
[ "public", "static", "<", "T", ",", "V", ">", "LazyIterable", "<", "V", ">", "flatCollect", "(", "Iterable", "<", "T", ">", "iterable", ",", "Function", "<", "?", "super", "T", ",", "?", "extends", "Iterable", "<", "V", ">", ">", "function", ")", "{...
Creates a deferred flattening iterable for the specified iterable
[ "Creates", "a", "deferred", "flattening", "iterable", "for", "the", "specified", "iterable" ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/LazyIterate.java#L100-L105
116,576
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/LazyIterate.java
LazyIterate.collectIf
public static <T, V> LazyIterable<V> collectIf( Iterable<T> iterable, Predicate<? super T> predicate, Function<? super T, ? extends V> function) { return LazyIterate.select(iterable, predicate).collect(function); }
java
public static <T, V> LazyIterable<V> collectIf( Iterable<T> iterable, Predicate<? super T> predicate, Function<? super T, ? extends V> function) { return LazyIterate.select(iterable, predicate).collect(function); }
[ "public", "static", "<", "T", ",", "V", ">", "LazyIterable", "<", "V", ">", "collectIf", "(", "Iterable", "<", "T", ">", "iterable", ",", "Predicate", "<", "?", "super", "T", ">", "predicate", ",", "Function", "<", "?", "super", "T", ",", "?", "ext...
Creates a deferred filtering and transforming iterable for the specified iterable
[ "Creates", "a", "deferred", "filtering", "and", "transforming", "iterable", "for", "the", "specified", "iterable" ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/LazyIterate.java#L110-L116
116,577
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/LazyIterate.java
LazyIterate.take
public static <T> LazyIterable<T> take(Iterable<T> iterable, int count) { return new TakeIterable<T>(iterable, count); }
java
public static <T> LazyIterable<T> take(Iterable<T> iterable, int count) { return new TakeIterable<T>(iterable, count); }
[ "public", "static", "<", "T", ">", "LazyIterable", "<", "T", ">", "take", "(", "Iterable", "<", "T", ">", "iterable", ",", "int", "count", ")", "{", "return", "new", "TakeIterable", "<", "T", ">", "(", "iterable", ",", "count", ")", ";", "}" ]
Creates a deferred take iterable for the specified iterable using the specified count as the limit
[ "Creates", "a", "deferred", "take", "iterable", "for", "the", "specified", "iterable", "using", "the", "specified", "count", "as", "the", "limit" ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/LazyIterate.java#L121-L124
116,578
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/LazyIterate.java
LazyIterate.drop
public static <T> LazyIterable<T> drop(Iterable<T> iterable, int count) { return new DropIterable<T>(iterable, count); }
java
public static <T> LazyIterable<T> drop(Iterable<T> iterable, int count) { return new DropIterable<T>(iterable, count); }
[ "public", "static", "<", "T", ">", "LazyIterable", "<", "T", ">", "drop", "(", "Iterable", "<", "T", ">", "iterable", ",", "int", "count", ")", "{", "return", "new", "DropIterable", "<", "T", ">", "(", "iterable", ",", "count", ")", ";", "}" ]
Creates a deferred drop iterable for the specified iterable using the specified count as the size to drop
[ "Creates", "a", "deferred", "drop", "iterable", "for", "the", "specified", "iterable", "using", "the", "specified", "count", "as", "the", "size", "to", "drop" ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/LazyIterate.java#L129-L132
116,579
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/LazyIterate.java
LazyIterate.distinct
public static <T> LazyIterable<T> distinct(Iterable<T> iterable) { return new DistinctIterable<T>(iterable); }
java
public static <T> LazyIterable<T> distinct(Iterable<T> iterable) { return new DistinctIterable<T>(iterable); }
[ "public", "static", "<", "T", ">", "LazyIterable", "<", "T", ">", "distinct", "(", "Iterable", "<", "T", ">", "iterable", ")", "{", "return", "new", "DistinctIterable", "<", "T", ">", "(", "iterable", ")", ";", "}" ]
Creates a deferred distinct iterable for the specified iterable @since 5.0
[ "Creates", "a", "deferred", "distinct", "iterable", "for", "the", "specified", "iterable" ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/LazyIterate.java#L139-L142
116,580
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/LazyIterate.java
LazyIterate.concatenate
public static <T> LazyIterable<T> concatenate(Iterable<T>... iterables) { return CompositeIterable.with(iterables); }
java
public static <T> LazyIterable<T> concatenate(Iterable<T>... iterables) { return CompositeIterable.with(iterables); }
[ "public", "static", "<", "T", ">", "LazyIterable", "<", "T", ">", "concatenate", "(", "Iterable", "<", "T", ">", "...", "iterables", ")", "{", "return", "CompositeIterable", ".", "with", "(", "iterables", ")", ";", "}" ]
Combines iterables into a deferred composite iterable
[ "Combines", "iterables", "into", "a", "deferred", "composite", "iterable" ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/LazyIterate.java#L147-L150
116,581
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/LazyIterate.java
LazyIterate.tap
public static <T> LazyIterable<T> tap(Iterable<T> iterable, Procedure<? super T> procedure) { return new TapIterable<T>(iterable, procedure); }
java
public static <T> LazyIterable<T> tap(Iterable<T> iterable, Procedure<? super T> procedure) { return new TapIterable<T>(iterable, procedure); }
[ "public", "static", "<", "T", ">", "LazyIterable", "<", "T", ">", "tap", "(", "Iterable", "<", "T", ">", "iterable", ",", "Procedure", "<", "?", "super", "T", ">", "procedure", ")", "{", "return", "new", "TapIterable", "<", "T", ">", "(", "iterable",...
Creates a deferred tap iterable for the specified iterable. @since 6.0
[ "Creates", "a", "deferred", "tap", "iterable", "for", "the", "specified", "iterable", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/LazyIterate.java#L177-L180
116,582
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/list/mutable/UnmodifiableMutableList.java
UnmodifiableMutableList.of
public static <E, L extends List<E>> UnmodifiableMutableList<E> of(L list) { if (list == null) { throw new IllegalArgumentException("cannot create an UnmodifiableMutableList for null"); } if (list instanceof RandomAccess) { return new RandomAccessUnmod...
java
public static <E, L extends List<E>> UnmodifiableMutableList<E> of(L list) { if (list == null) { throw new IllegalArgumentException("cannot create an UnmodifiableMutableList for null"); } if (list instanceof RandomAccess) { return new RandomAccessUnmod...
[ "public", "static", "<", "E", ",", "L", "extends", "List", "<", "E", ">", ">", "UnmodifiableMutableList", "<", "E", ">", "of", "(", "L", "list", ")", "{", "if", "(", "list", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"...
This method will take a MutableList and wrap it directly in a UnmodifiableMutableList. It will take any other non-GS-list and first adapt it will a ListAdapter, and then return a UnmodifiableMutableList that wraps the adapter.
[ "This", "method", "will", "take", "a", "MutableList", "and", "wrap", "it", "directly", "in", "a", "UnmodifiableMutableList", ".", "It", "will", "take", "any", "other", "non", "-", "GS", "-", "list", "and", "first", "adapt", "it", "will", "a", "ListAdapter"...
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/list/mutable/UnmodifiableMutableList.java#L86-L97
116,583
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/stack/mutable/SynchronizedStack.java
SynchronizedStack.of
public static <T, S extends MutableStack<T>> SynchronizedStack<T> of(S stack) { return new SynchronizedStack<T>(stack); }
java
public static <T, S extends MutableStack<T>> SynchronizedStack<T> of(S stack) { return new SynchronizedStack<T>(stack); }
[ "public", "static", "<", "T", ",", "S", "extends", "MutableStack", "<", "T", ">", ">", "SynchronizedStack", "<", "T", ">", "of", "(", "S", "stack", ")", "{", "return", "new", "SynchronizedStack", "<", "T", ">", "(", "stack", ")", ";", "}" ]
This method will take a MutableStack and wrap it directly in a SynchronizedStack.
[ "This", "method", "will", "take", "a", "MutableStack", "and", "wrap", "it", "directly", "in", "a", "SynchronizedStack", "." ]
fa8bf3e103689efa18bca2ab70203e71cde34b52
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/stack/mutable/SynchronizedStack.java#L114-L117
116,584
facebook/nailgun
nailgun-server/src/main/java/com/facebook/nailgun/ThreadLocalPrintStream.java
ThreadLocalPrintStream.getPrintStream
PrintStream getPrintStream() { PrintStream result = (PrintStream) streams.get(); return ((result == null) ? defaultPrintStream : result); }
java
PrintStream getPrintStream() { PrintStream result = (PrintStream) streams.get(); return ((result == null) ? defaultPrintStream : result); }
[ "PrintStream", "getPrintStream", "(", ")", "{", "PrintStream", "result", "=", "(", "PrintStream", ")", "streams", ".", "get", "(", ")", ";", "return", "(", "(", "result", "==", "null", ")", "?", "defaultPrintStream", ":", "result", ")", ";", "}" ]
Returns this thread's PrintStream @return this thread's PrintStream
[ "Returns", "this", "thread", "s", "PrintStream" ]
948c51c5fce138c65bb3df369c3f7b4d01440605
https://github.com/facebook/nailgun/blob/948c51c5fce138c65bb3df369c3f7b4d01440605/nailgun-server/src/main/java/com/facebook/nailgun/ThreadLocalPrintStream.java#L66-L69
116,585
facebook/nailgun
nailgun-server/src/main/java/com/facebook/nailgun/NGServer.java
NGServer.getOrCreateStatsFor
private NailStats getOrCreateStatsFor(Class nailClass) { NailStats result; synchronized (allNailStats) { String nailClassName = nailClass.getName(); result = allNailStats.get(nailClassName); if (result == null) { result = new NailStats(nailClassName); allNailStats.put(nailClass...
java
private NailStats getOrCreateStatsFor(Class nailClass) { NailStats result; synchronized (allNailStats) { String nailClassName = nailClass.getName(); result = allNailStats.get(nailClassName); if (result == null) { result = new NailStats(nailClassName); allNailStats.put(nailClass...
[ "private", "NailStats", "getOrCreateStatsFor", "(", "Class", "nailClass", ")", "{", "NailStats", "result", ";", "synchronized", "(", "allNailStats", ")", "{", "String", "nailClassName", "=", "nailClass", ".", "getName", "(", ")", ";", "result", "=", "allNailStat...
Returns the current NailStats object for the specified class, creating a new one if necessary @param nailClass the class for which we're gathering stats @return a NailStats object for the specified class
[ "Returns", "the", "current", "NailStats", "object", "for", "the", "specified", "class", "creating", "a", "new", "one", "if", "necessary" ]
948c51c5fce138c65bb3df369c3f7b4d01440605
https://github.com/facebook/nailgun/blob/948c51c5fce138c65bb3df369c3f7b4d01440605/nailgun-server/src/main/java/com/facebook/nailgun/NGServer.java#L205-L216
116,586
facebook/nailgun
nailgun-server/src/main/java/com/facebook/nailgun/NGServer.java
NGServer.shutdown
public void shutdown() { if (shutdown.getAndSet(true)) { return; } // NGServer main thread might be blocking on socket in `accept()`, so we close the socket // here to unblock it and finish gracefully try { serversocket.close(); } catch (Throwable ex) { LOG.log(Level.WARNING, ...
java
public void shutdown() { if (shutdown.getAndSet(true)) { return; } // NGServer main thread might be blocking on socket in `accept()`, so we close the socket // here to unblock it and finish gracefully try { serversocket.close(); } catch (Throwable ex) { LOG.log(Level.WARNING, ...
[ "public", "void", "shutdown", "(", ")", "{", "if", "(", "shutdown", ".", "getAndSet", "(", "true", ")", ")", "{", "return", ";", "}", "// NGServer main thread might be blocking on socket in `accept()`, so we close the socket", "// here to unblock it and finish gracefully", ...
Shuts down the server. The server will stop listening and its thread will finish. Any running nails will be allowed to finish. <p>Any nails that provide a <pre><code>public static void nailShutdown(NGServer)</code></pre> method will have this method called with this NGServer as its sole parameter.
[ "Shuts", "down", "the", "server", ".", "The", "server", "will", "stop", "listening", "and", "its", "thread", "will", "finish", ".", "Any", "running", "nails", "will", "be", "allowed", "to", "finish", "." ]
948c51c5fce138c65bb3df369c3f7b4d01440605
https://github.com/facebook/nailgun/blob/948c51c5fce138c65bb3df369c3f7b4d01440605/nailgun-server/src/main/java/com/facebook/nailgun/NGServer.java#L283-L295
116,587
facebook/nailgun
nailgun-server/src/main/java/com/facebook/nailgun/NGServer.java
NGServer.run
public void run() { originalSecurityManager = System.getSecurityManager(); System.setSecurityManager(new NGSecurityManager(originalSecurityManager)); if (!(System.in instanceof ThreadLocalInputStream)) { System.setIn(new ThreadLocalInputStream(in)); } if (!(System.out instanceof ThreadLocalPr...
java
public void run() { originalSecurityManager = System.getSecurityManager(); System.setSecurityManager(new NGSecurityManager(originalSecurityManager)); if (!(System.in instanceof ThreadLocalInputStream)) { System.setIn(new ThreadLocalInputStream(in)); } if (!(System.out instanceof ThreadLocalPr...
[ "public", "void", "run", "(", ")", "{", "originalSecurityManager", "=", "System", ".", "getSecurityManager", "(", ")", ";", "System", ".", "setSecurityManager", "(", "new", "NGSecurityManager", "(", "originalSecurityManager", ")", ")", ";", "if", "(", "!", "("...
Listens for new connections and launches NGSession threads to process them.
[ "Listens", "for", "new", "connections", "and", "launches", "NGSession", "threads", "to", "process", "them", "." ]
948c51c5fce138c65bb3df369c3f7b4d01440605
https://github.com/facebook/nailgun/blob/948c51c5fce138c65bb3df369c3f7b4d01440605/nailgun-server/src/main/java/com/facebook/nailgun/NGServer.java#L316-L415
116,588
facebook/nailgun
nailgun-server/src/main/java/com/facebook/nailgun/AliasManager.java
AliasManager.getAliases
public Set getAliases() { Set result = new java.util.TreeSet(); synchronized (aliases) { result.addAll(aliases.values()); } return (result); }
java
public Set getAliases() { Set result = new java.util.TreeSet(); synchronized (aliases) { result.addAll(aliases.values()); } return (result); }
[ "public", "Set", "getAliases", "(", ")", "{", "Set", "result", "=", "new", "java", ".", "util", ".", "TreeSet", "(", ")", ";", "synchronized", "(", "aliases", ")", "{", "result", ".", "addAll", "(", "aliases", ".", "values", "(", ")", ")", ";", "}"...
Returns a Set that is a snapshot of the Alias list. Modifications to this Set will not impact the AliasManager in any way. @return a Set that is a snapshot of the Alias list.
[ "Returns", "a", "Set", "that", "is", "a", "snapshot", "of", "the", "Alias", "list", ".", "Modifications", "to", "this", "Set", "will", "not", "impact", "the", "AliasManager", "in", "any", "way", "." ]
948c51c5fce138c65bb3df369c3f7b4d01440605
https://github.com/facebook/nailgun/blob/948c51c5fce138c65bb3df369c3f7b4d01440605/nailgun-server/src/main/java/com/facebook/nailgun/AliasManager.java#L106-L112
116,589
facebook/nailgun
nailgun-server/src/main/java/com/facebook/nailgun/NGConstants.java
NGConstants.getVersion
private static String getVersion() { Properties props = new Properties(); try (InputStream is = NGConstants.class.getResourceAsStream( "/META-INF/maven/com.facebook/nailgun-server/pom.properties")) { props.load(is); } catch (Throwable e) { // In static initialization context,...
java
private static String getVersion() { Properties props = new Properties(); try (InputStream is = NGConstants.class.getResourceAsStream( "/META-INF/maven/com.facebook/nailgun-server/pom.properties")) { props.load(is); } catch (Throwable e) { // In static initialization context,...
[ "private", "static", "String", "getVersion", "(", ")", "{", "Properties", "props", "=", "new", "Properties", "(", ")", ";", "try", "(", "InputStream", "is", "=", "NGConstants", ".", "class", ".", "getResourceAsStream", "(", "\"/META-INF/maven/com.facebook/nailgun-...
Loads the version number from a file generated by Maven.
[ "Loads", "the", "version", "number", "from", "a", "file", "generated", "by", "Maven", "." ]
948c51c5fce138c65bb3df369c3f7b4d01440605
https://github.com/facebook/nailgun/blob/948c51c5fce138c65bb3df369c3f7b4d01440605/nailgun-server/src/main/java/com/facebook/nailgun/NGConstants.java#L82-L93
116,590
facebook/nailgun
nailgun-server/src/main/java/com/facebook/nailgun/ThreadLocalInputStream.java
ThreadLocalInputStream.getInputStream
InputStream getInputStream() { InputStream result = (InputStream) streams.get(); return ((result == null) ? defaultInputStream : result); }
java
InputStream getInputStream() { InputStream result = (InputStream) streams.get(); return ((result == null) ? defaultInputStream : result); }
[ "InputStream", "getInputStream", "(", ")", "{", "InputStream", "result", "=", "(", "InputStream", ")", "streams", ".", "get", "(", ")", ";", "return", "(", "(", "result", "==", "null", ")", "?", "defaultInputStream", ":", "result", ")", ";", "}" ]
Returns this thread's InputStream @return this thread's InputStream
[ "Returns", "this", "thread", "s", "InputStream" ]
948c51c5fce138c65bb3df369c3f7b4d01440605
https://github.com/facebook/nailgun/blob/948c51c5fce138c65bb3df369c3f7b4d01440605/nailgun-server/src/main/java/com/facebook/nailgun/ThreadLocalInputStream.java#L64-L67
116,591
facebook/nailgun
nailgun-examples/src/main/java/com/facebook/nailgun/examples/Hash.java
Hash.getCryptoImpls
private static Set getCryptoImpls(String serviceType) { Set result = new TreeSet(); // All all providers Provider[] providers = Security.getProviders(); for (int i = 0; i < providers.length; i++) { // Get services provided by each provider Set keys = providers[i].keySet(); for (Object...
java
private static Set getCryptoImpls(String serviceType) { Set result = new TreeSet(); // All all providers Provider[] providers = Security.getProviders(); for (int i = 0; i < providers.length; i++) { // Get services provided by each provider Set keys = providers[i].keySet(); for (Object...
[ "private", "static", "Set", "getCryptoImpls", "(", "String", "serviceType", ")", "{", "Set", "result", "=", "new", "TreeSet", "(", ")", ";", "// All all providers", "Provider", "[", "]", "providers", "=", "Security", ".", "getProviders", "(", ")", ";", "for"...
Provides a list of algorithms for the specified service (which, for our purposes, is "MessageDigest". <p>This method was only very slightly adapted (to use a TreeSet) from the Java Almanac at http://javaalmanac.com/egs/java.security/ListServices.html @param serviceType The name of the service we're looking for. It's ...
[ "Provides", "a", "list", "of", "algorithms", "for", "the", "specified", "service", "(", "which", "for", "our", "purposes", "is", "MessageDigest", "." ]
948c51c5fce138c65bb3df369c3f7b4d01440605
https://github.com/facebook/nailgun/blob/948c51c5fce138c65bb3df369c3f7b4d01440605/nailgun-examples/src/main/java/com/facebook/nailgun/examples/Hash.java#L50-L71
116,592
facebook/nailgun
nailgun-server/src/main/java/com/facebook/nailgun/NGSessionPool.java
NGSessionPool.take
NGSession take() { synchronized (lock) { if (done) { throw new UnsupportedOperationException("NGSession pool is shutting down"); } NGSession session = idlePool.poll(); if (session == null) { session = instanceCreator.get(); session.start(); } workingPool.a...
java
NGSession take() { synchronized (lock) { if (done) { throw new UnsupportedOperationException("NGSession pool is shutting down"); } NGSession session = idlePool.poll(); if (session == null) { session = instanceCreator.get(); session.start(); } workingPool.a...
[ "NGSession", "take", "(", ")", "{", "synchronized", "(", "lock", ")", "{", "if", "(", "done", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"NGSession pool is shutting down\"", ")", ";", "}", "NGSession", "session", "=", "idlePool", ".", "p...
Returns an NGSession from the pool, or creates one if necessary @return an NGSession ready to work
[ "Returns", "an", "NGSession", "from", "the", "pool", "or", "creates", "one", "if", "necessary" ]
948c51c5fce138c65bb3df369c3f7b4d01440605
https://github.com/facebook/nailgun/blob/948c51c5fce138c65bb3df369c3f7b4d01440605/nailgun-server/src/main/java/com/facebook/nailgun/NGSessionPool.java#L91-L104
116,593
facebook/nailgun
nailgun-server/src/main/java/com/facebook/nailgun/NGSessionPool.java
NGSessionPool.give
void give(NGSession session) { synchronized (lock) { if (done) { // session is already signalled shutdown and removed from all collections return; } workingPool.remove(session); if (idlePool.size() < maxIdleSessions) { idlePool.add(session); return; } ...
java
void give(NGSession session) { synchronized (lock) { if (done) { // session is already signalled shutdown and removed from all collections return; } workingPool.remove(session); if (idlePool.size() < maxIdleSessions) { idlePool.add(session); return; } ...
[ "void", "give", "(", "NGSession", "session", ")", "{", "synchronized", "(", "lock", ")", "{", "if", "(", "done", ")", "{", "// session is already signalled shutdown and removed from all collections", "return", ";", "}", "workingPool", ".", "remove", "(", "session", ...
Returns an NGSession to the pool. The pool may choose to shutdown the thread if idle pool is full. @param session the NGSession to return to the pool
[ "Returns", "an", "NGSession", "to", "the", "pool", ".", "The", "pool", "may", "choose", "to", "shutdown", "the", "thread", "if", "idle", "pool", "is", "full", "." ]
948c51c5fce138c65bb3df369c3f7b4d01440605
https://github.com/facebook/nailgun/blob/948c51c5fce138c65bb3df369c3f7b4d01440605/nailgun-server/src/main/java/com/facebook/nailgun/NGSessionPool.java#L112-L126
116,594
facebook/nailgun
nailgun-server/src/main/java/com/facebook/nailgun/NGSessionPool.java
NGSessionPool.shutdown
void shutdown() throws InterruptedException { List<NGSession> allSessions; synchronized (lock) { done = true; allSessions = Stream.concat(workingPool.stream(), idlePool.stream()).collect(Collectors.toList()); idlePool.clear(); workingPool.clear(); } for (NGSession sessi...
java
void shutdown() throws InterruptedException { List<NGSession> allSessions; synchronized (lock) { done = true; allSessions = Stream.concat(workingPool.stream(), idlePool.stream()).collect(Collectors.toList()); idlePool.clear(); workingPool.clear(); } for (NGSession sessi...
[ "void", "shutdown", "(", ")", "throws", "InterruptedException", "{", "List", "<", "NGSession", ">", "allSessions", ";", "synchronized", "(", "lock", ")", "{", "done", "=", "true", ";", "allSessions", "=", "Stream", ".", "concat", "(", "workingPool", ".", "...
Shuts down the pool. The function waits for running nails to finish.
[ "Shuts", "down", "the", "pool", ".", "The", "function", "waits", "for", "running", "nails", "to", "finish", "." ]
948c51c5fce138c65bb3df369c3f7b4d01440605
https://github.com/facebook/nailgun/blob/948c51c5fce138c65bb3df369c3f7b4d01440605/nailgun-server/src/main/java/com/facebook/nailgun/NGSessionPool.java#L129-L161
116,595
facebook/nailgun
nailgun-server/src/main/java/com/facebook/nailgun/NGCommunicator.java
NGCommunicator.readCommandContext
CommandContext readCommandContext() throws IOException { // client info - command line arguments and environment List<String> remoteArgs = new ArrayList(); Properties remoteEnv = new Properties(); String cwd = null; // working directory String command = null; // alias or class name // read every...
java
CommandContext readCommandContext() throws IOException { // client info - command line arguments and environment List<String> remoteArgs = new ArrayList(); Properties remoteEnv = new Properties(); String cwd = null; // working directory String command = null; // alias or class name // read every...
[ "CommandContext", "readCommandContext", "(", ")", "throws", "IOException", "{", "// client info - command line arguments and environment", "List", "<", "String", ">", "remoteArgs", "=", "new", "ArrayList", "(", ")", ";", "Properties", "remoteEnv", "=", "new", "Propertie...
Get nail command context from the header and start reading for stdin and heartbeats
[ "Get", "nail", "command", "context", "from", "the", "header", "and", "start", "reading", "for", "stdin", "and", "heartbeats" ]
948c51c5fce138c65bb3df369c3f7b4d01440605
https://github.com/facebook/nailgun/blob/948c51c5fce138c65bb3df369c3f7b4d01440605/nailgun-server/src/main/java/com/facebook/nailgun/NGCommunicator.java#L129-L178
116,596
facebook/nailgun
nailgun-server/src/main/java/com/facebook/nailgun/NGCommunicator.java
NGCommunicator.startBackgroundReceive
private void startBackgroundReceive() { // Read timeout, including heartbeats, should be handled by socket. // However Java Socket/Stream API does not enforce that. To stay on safer side, // use timeout on a future // let socket timeout first, set rough timeout to 110% of original long futureTimeou...
java
private void startBackgroundReceive() { // Read timeout, including heartbeats, should be handled by socket. // However Java Socket/Stream API does not enforce that. To stay on safer side, // use timeout on a future // let socket timeout first, set rough timeout to 110% of original long futureTimeou...
[ "private", "void", "startBackgroundReceive", "(", ")", "{", "// Read timeout, including heartbeats, should be handled by socket.", "// However Java Socket/Stream API does not enforce that. To stay on safer side,", "// use timeout on a future", "// let socket timeout first, set rough timeout to 110...
Call this to move all reads, like heartbeats and stdin, to be performed by background thread. This method should only be called once, as header data is read from the input stream.
[ "Call", "this", "to", "move", "all", "reads", "like", "heartbeats", "and", "stdin", "to", "be", "performed", "by", "background", "thread", ".", "This", "method", "should", "only", "be", "called", "once", "as", "header", "data", "is", "read", "from", "the",...
948c51c5fce138c65bb3df369c3f7b4d01440605
https://github.com/facebook/nailgun/blob/948c51c5fce138c65bb3df369c3f7b4d01440605/nailgun-server/src/main/java/com/facebook/nailgun/NGCommunicator.java#L184-L266
116,597
facebook/nailgun
nailgun-server/src/main/java/com/facebook/nailgun/NGCommunicator.java
NGCommunicator.exit
void exit(int exitCode) { if (isExited) { return; } // First, stop reading from the socket. If we won't do that then client receives an exit code // and terminates // the socket on its end, causing readExecutor to throw try { stopIn(); } catch (IOException ex) { LOG.log( ...
java
void exit(int exitCode) { if (isExited) { return; } // First, stop reading from the socket. If we won't do that then client receives an exit code // and terminates // the socket on its end, causing readExecutor to throw try { stopIn(); } catch (IOException ex) { LOG.log( ...
[ "void", "exit", "(", "int", "exitCode", ")", "{", "if", "(", "isExited", ")", "{", "return", ";", "}", "// First, stop reading from the socket. If we won't do that then client receives an exit code", "// and terminates", "// the socket on its end, causing readExecutor to throw", ...
Signal nail completion to the client. It will close communication socket afterwards, so any read or write would result in an error This method is idempotent and need to be called only once. Any subsequent call will result in noop. @param exitCode exit code as output by Nailgun client
[ "Signal", "nail", "completion", "to", "the", "client", ".", "It", "will", "close", "communication", "socket", "afterwards", "so", "any", "read", "or", "write", "would", "result", "in", "an", "error", "This", "method", "is", "idempotent", "and", "need", "to",...
948c51c5fce138c65bb3df369c3f7b4d01440605
https://github.com/facebook/nailgun/blob/948c51c5fce138c65bb3df369c3f7b4d01440605/nailgun-server/src/main/java/com/facebook/nailgun/NGCommunicator.java#L325-L353
116,598
facebook/nailgun
nailgun-server/src/main/java/com/facebook/nailgun/NGCommunicator.java
NGCommunicator.stopIn
private void stopIn() throws IOException { if (inClosed) { return; } inClosed = true; LOG.log(Level.FINE, "Shutting down socket for input"); // unblock all waiting readers setEof(); // signal orchestrator thread it is ok to quit now as there will be no more input synchronized (o...
java
private void stopIn() throws IOException { if (inClosed) { return; } inClosed = true; LOG.log(Level.FINE, "Shutting down socket for input"); // unblock all waiting readers setEof(); // signal orchestrator thread it is ok to quit now as there will be no more input synchronized (o...
[ "private", "void", "stopIn", "(", ")", "throws", "IOException", "{", "if", "(", "inClosed", ")", "{", "return", ";", "}", "inClosed", "=", "true", ";", "LOG", ".", "log", "(", "Level", ".", "FINE", ",", "\"Shutting down socket for input\"", ")", ";", "//...
Stop the thread reading stdin from the NailGun client
[ "Stop", "the", "thread", "reading", "stdin", "from", "the", "NailGun", "client" ]
948c51c5fce138c65bb3df369c3f7b4d01440605
https://github.com/facebook/nailgun/blob/948c51c5fce138c65bb3df369c3f7b4d01440605/nailgun-server/src/main/java/com/facebook/nailgun/NGCommunicator.java#L356-L376
116,599
facebook/nailgun
nailgun-server/src/main/java/com/facebook/nailgun/NGCommunicator.java
NGCommunicator.stopOut
private void stopOut() throws IOException { if (outClosed) { return; } outClosed = true; LOG.log(Level.FINE, "Shutting down socket for output"); // close socket for output - that will initiate normal socket close procedure; in case of TCP // socket this is // a buffer flush and TCP t...
java
private void stopOut() throws IOException { if (outClosed) { return; } outClosed = true; LOG.log(Level.FINE, "Shutting down socket for output"); // close socket for output - that will initiate normal socket close procedure; in case of TCP // socket this is // a buffer flush and TCP t...
[ "private", "void", "stopOut", "(", ")", "throws", "IOException", "{", "if", "(", "outClosed", ")", "{", "return", ";", "}", "outClosed", "=", "true", ";", "LOG", ".", "log", "(", "Level", ".", "FINE", ",", "\"Shutting down socket for output\"", ")", ";", ...
Close socket for output and terminate connection, any attempt to write anything to it after that will yield to IOException
[ "Close", "socket", "for", "output", "and", "terminate", "connection", "any", "attempt", "to", "write", "anything", "to", "it", "after", "that", "will", "yield", "to", "IOException" ]
948c51c5fce138c65bb3df369c3f7b4d01440605
https://github.com/facebook/nailgun/blob/948c51c5fce138c65bb3df369c3f7b4d01440605/nailgun-server/src/main/java/com/facebook/nailgun/NGCommunicator.java#L382-L394