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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
117,200 | jOOQ/jOOL | jOOL-java-8/src/main/java/org/jooq/lambda/tuple/Tuple3.java | Tuple3.split3 | public final Tuple2<Tuple3<T1, T2, T3>, Tuple0> split3() {
return new Tuple2<>(limit3(), skip3());
} | java | public final Tuple2<Tuple3<T1, T2, T3>, Tuple0> split3() {
return new Tuple2<>(limit3(), skip3());
} | [
"public",
"final",
"Tuple2",
"<",
"Tuple3",
"<",
"T1",
",",
"T2",
",",
"T3",
">",
",",
"Tuple0",
">",
"split3",
"(",
")",
"{",
"return",
"new",
"Tuple2",
"<>",
"(",
"limit3",
"(",
")",
",",
"skip3",
"(",
")",
")",
";",
"}"
] | Split this tuple into two tuples of degree 3 and 0. | [
"Split",
"this",
"tuple",
"into",
"two",
"tuples",
"of",
"degree",
"3",
"and",
"0",
"."
] | 889d87c85ca57bafd4eddd78e0f7ae2804d2ee86 | https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/tuple/Tuple3.java#L191-L193 |
117,201 | jOOQ/jOOL | jOOL-java-8/src/main/java/org/jooq/lambda/tuple/Tuple4.java | Tuple4.split0 | public final Tuple2<Tuple0, Tuple4<T1, T2, T3, T4>> split0() {
return new Tuple2<>(limit0(), skip0());
} | java | public final Tuple2<Tuple0, Tuple4<T1, T2, T3, T4>> split0() {
return new Tuple2<>(limit0(), skip0());
} | [
"public",
"final",
"Tuple2",
"<",
"Tuple0",
",",
"Tuple4",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
">",
">",
"split0",
"(",
")",
"{",
"return",
"new",
"Tuple2",
"<>",
"(",
"limit0",
"(",
")",
",",
"skip0",
"(",
")",
")",
";",
"}"
] | Split this tuple into two tuples of degree 0 and 4. | [
"Split",
"this",
"tuple",
"into",
"two",
"tuples",
"of",
"degree",
"0",
"and",
"4",
"."
] | 889d87c85ca57bafd4eddd78e0f7ae2804d2ee86 | https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/tuple/Tuple4.java#L170-L172 |
117,202 | jOOQ/jOOL | jOOL-java-8/src/main/java/org/jooq/lambda/tuple/Tuple4.java | Tuple4.split1 | public final Tuple2<Tuple1<T1>, Tuple3<T2, T3, T4>> split1() {
return new Tuple2<>(limit1(), skip1());
} | java | public final Tuple2<Tuple1<T1>, Tuple3<T2, T3, T4>> split1() {
return new Tuple2<>(limit1(), skip1());
} | [
"public",
"final",
"Tuple2",
"<",
"Tuple1",
"<",
"T1",
">",
",",
"Tuple3",
"<",
"T2",
",",
"T3",
",",
"T4",
">",
">",
"split1",
"(",
")",
"{",
"return",
"new",
"Tuple2",
"<>",
"(",
"limit1",
"(",
")",
",",
"skip1",
"(",
")",
")",
";",
"}"
] | Split this tuple into two tuples of degree 1 and 3. | [
"Split",
"this",
"tuple",
"into",
"two",
"tuples",
"of",
"degree",
"1",
"and",
"3",
"."
] | 889d87c85ca57bafd4eddd78e0f7ae2804d2ee86 | https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/tuple/Tuple4.java#L177-L179 |
117,203 | jOOQ/jOOL | jOOL-java-8/src/main/java/org/jooq/lambda/tuple/Tuple4.java | Tuple4.split4 | public final Tuple2<Tuple4<T1, T2, T3, T4>, Tuple0> split4() {
return new Tuple2<>(limit4(), skip4());
} | java | public final Tuple2<Tuple4<T1, T2, T3, T4>, Tuple0> split4() {
return new Tuple2<>(limit4(), skip4());
} | [
"public",
"final",
"Tuple2",
"<",
"Tuple4",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
">",
",",
"Tuple0",
">",
"split4",
"(",
")",
"{",
"return",
"new",
"Tuple2",
"<>",
"(",
"limit4",
"(",
")",
",",
"skip4",
"(",
")",
")",
";",
"}"
] | Split this tuple into two tuples of degree 4 and 0. | [
"Split",
"this",
"tuple",
"into",
"two",
"tuples",
"of",
"degree",
"4",
"and",
"0",
"."
] | 889d87c85ca57bafd4eddd78e0f7ae2804d2ee86 | https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/tuple/Tuple4.java#L198-L200 |
117,204 | jOOQ/jOOL | jOOL-java-8/src/main/java/org/jooq/lambda/tuple/Tuple4.java | Tuple4.map4 | public final <U4> Tuple4<T1, T2, T3, U4> map4(Function<? super T4, ? extends U4> function) {
return Tuple.tuple(v1, v2, v3, function.apply(v4));
} | java | public final <U4> Tuple4<T1, T2, T3, U4> map4(Function<? super T4, ? extends U4> function) {
return Tuple.tuple(v1, v2, v3, function.apply(v4));
} | [
"public",
"final",
"<",
"U4",
">",
"Tuple4",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"U4",
">",
"map4",
"(",
"Function",
"<",
"?",
"super",
"T4",
",",
"?",
"extends",
"U4",
">",
"function",
")",
"{",
"return",
"Tuple",
".",
"tuple",
"(",
"v1",
",... | Apply attribute 4 as argument to a function and return a new tuple with the substituted argument. | [
"Apply",
"attribute",
"4",
"as",
"argument",
"to",
"a",
"function",
"and",
"return",
"a",
"new",
"tuple",
"with",
"the",
"substituted",
"argument",
"."
] | 889d87c85ca57bafd4eddd78e0f7ae2804d2ee86 | https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/tuple/Tuple4.java#L303-L305 |
117,205 | jOOQ/jOOL | jOOL/src/main/java/org/jooq/lambda/tuple/Tuple16.java | Tuple16.skip12 | public final Tuple4<T13, T14, T15, T16> skip12() {
return new Tuple4<>(v13, v14, v15, v16);
} | java | public final Tuple4<T13, T14, T15, T16> skip12() {
return new Tuple4<>(v13, v14, v15, v16);
} | [
"public",
"final",
"Tuple4",
"<",
"T13",
",",
"T14",
",",
"T15",
",",
"T16",
">",
"skip12",
"(",
")",
"{",
"return",
"new",
"Tuple4",
"<>",
"(",
"v13",
",",
"v14",
",",
"v15",
",",
"v16",
")",
";",
"}"
] | Skip 12 degrees from this tuple. | [
"Skip",
"12",
"degrees",
"from",
"this",
"tuple",
"."
] | 889d87c85ca57bafd4eddd78e0f7ae2804d2ee86 | https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL/src/main/java/org/jooq/lambda/tuple/Tuple16.java#L485-L487 |
117,206 | jOOQ/jOOL | jOOL-java-8/src/main/java/org/jooq/lambda/tuple/Tuple9.java | Tuple9.limit9 | public final Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9> limit9() {
return this;
} | java | public final Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9> limit9() {
return this;
} | [
"public",
"final",
"Tuple9",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
",",
"T5",
",",
"T6",
",",
"T7",
",",
"T8",
",",
"T9",
">",
"limit9",
"(",
")",
"{",
"return",
"this",
";",
"}"
] | Limit this tuple to degree 9. | [
"Limit",
"this",
"tuple",
"to",
"degree",
"9",
"."
] | 889d87c85ca57bafd4eddd78e0f7ae2804d2ee86 | https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/tuple/Tuple9.java#L303-L305 |
117,207 | jOOQ/jOOL | jOOL/src/main/java/org/jooq/lambda/tuple/Tuple8.java | Tuple8.split1 | public final Tuple2<Tuple1<T1>, Tuple7<T2, T3, T4, T5, T6, T7, T8>> split1() {
return new Tuple2<>(limit1(), skip1());
} | java | public final Tuple2<Tuple1<T1>, Tuple7<T2, T3, T4, T5, T6, T7, T8>> split1() {
return new Tuple2<>(limit1(), skip1());
} | [
"public",
"final",
"Tuple2",
"<",
"Tuple1",
"<",
"T1",
">",
",",
"Tuple7",
"<",
"T2",
",",
"T3",
",",
"T4",
",",
"T5",
",",
"T6",
",",
"T7",
",",
"T8",
">",
">",
"split1",
"(",
")",
"{",
"return",
"new",
"Tuple2",
"<>",
"(",
"limit1",
"(",
")... | Split this tuple into two tuples of degree 1 and 7. | [
"Split",
"this",
"tuple",
"into",
"two",
"tuples",
"of",
"degree",
"1",
"and",
"7",
"."
] | 889d87c85ca57bafd4eddd78e0f7ae2804d2ee86 | https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL/src/main/java/org/jooq/lambda/tuple/Tuple8.java#L177-L179 |
117,208 | jOOQ/jOOL | jOOL/src/main/java/org/jooq/lambda/tuple/Tuple8.java | Tuple8.limit8 | public final Tuple8<T1, T2, T3, T4, T5, T6, T7, T8> limit8() {
return this;
} | java | public final Tuple8<T1, T2, T3, T4, T5, T6, T7, T8> limit8() {
return this;
} | [
"public",
"final",
"Tuple8",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
",",
"T5",
",",
"T6",
",",
"T7",
",",
"T8",
">",
"limit8",
"(",
")",
"{",
"return",
"this",
";",
"}"
] | Limit this tuple to degree 8. | [
"Limit",
"this",
"tuple",
"to",
"degree",
"8",
"."
] | 889d87c85ca57bafd4eddd78e0f7ae2804d2ee86 | https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL/src/main/java/org/jooq/lambda/tuple/Tuple8.java#L289-L291 |
117,209 | amaembo/streamex | src/main/java/one/util/streamex/StreamEx.java | StreamEx.filterBy | public <K> StreamEx<T> filterBy(Function<? super T, ? extends K> mapper, K value) {
return value == null ? filter(t -> mapper.apply(t) == null) : filter(t -> value.equals(mapper.apply(t)));
} | java | public <K> StreamEx<T> filterBy(Function<? super T, ? extends K> mapper, K value) {
return value == null ? filter(t -> mapper.apply(t) == null) : filter(t -> value.equals(mapper.apply(t)));
} | [
"public",
"<",
"K",
">",
"StreamEx",
"<",
"T",
">",
"filterBy",
"(",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"K",
">",
"mapper",
",",
"K",
"value",
")",
"{",
"return",
"value",
"==",
"null",
"?",
"filter",
"(",
"t",
"->",
"mapper... | Returns a stream consisting of the elements of this stream for which the
supplied mapper function returns the given value.
<p>
This is an <a href="package-summary.html#StreamOps">intermediate
operation</a>.
<p>
This method behaves like
{@code filter(t -> Objects.equals(value, mapper.apply(t)))}.
@param <K> type of t... | [
"Returns",
"a",
"stream",
"consisting",
"of",
"the",
"elements",
"of",
"this",
"stream",
"for",
"which",
"the",
"supplied",
"mapper",
"function",
"returns",
"the",
"given",
"value",
"."
] | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/StreamEx.java#L132-L134 |
117,210 | amaembo/streamex | src/main/java/one/util/streamex/StreamEx.java | StreamEx.toArray | @SuppressWarnings("unchecked")
public <A> A[] toArray(Class<A> elementClass) {
return stream().toArray(size -> (A[])Array.newInstance(elementClass, size));
} | java | @SuppressWarnings("unchecked")
public <A> A[] toArray(Class<A> elementClass) {
return stream().toArray(size -> (A[])Array.newInstance(elementClass, size));
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"A",
">",
"A",
"[",
"]",
"toArray",
"(",
"Class",
"<",
"A",
">",
"elementClass",
")",
"{",
"return",
"stream",
"(",
")",
".",
"toArray",
"(",
"size",
"->",
"(",
"A",
"[",
"]",
")",
... | Returns an array containing all the stream elements using the supplied
element type class to allocate an array.
<p>
This is a <a href="package-summary.html#StreamOps">terminal</a>
operation.
@param <A> the element type of the resulting array
@param elementClass the type of array elements
@return an array containing t... | [
"Returns",
"an",
"array",
"containing",
"all",
"the",
"stream",
"elements",
"using",
"the",
"supplied",
"element",
"type",
"class",
"to",
"allocate",
"an",
"array",
"."
] | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/StreamEx.java#L807-L810 |
117,211 | amaembo/streamex | src/main/java/one/util/streamex/StreamEx.java | StreamEx.toArray | @SuppressWarnings("unchecked")
public <A> A[] toArray(A[] emptyArray) {
if(emptyArray.length != 0) {
throw new IllegalArgumentException("Empty array must be supplied");
}
return stream().toArray(size -> size == 0 ? emptyArray
: (A[]) Array.newInstance(emptyArray.g... | java | @SuppressWarnings("unchecked")
public <A> A[] toArray(A[] emptyArray) {
if(emptyArray.length != 0) {
throw new IllegalArgumentException("Empty array must be supplied");
}
return stream().toArray(size -> size == 0 ? emptyArray
: (A[]) Array.newInstance(emptyArray.g... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"A",
">",
"A",
"[",
"]",
"toArray",
"(",
"A",
"[",
"]",
"emptyArray",
")",
"{",
"if",
"(",
"emptyArray",
".",
"length",
"!=",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
... | Returns an array containing all the stream elements. If the stream
happens to contain no elements, the supplied empty array is returned
instead. Otherwise the new array is allocated which element type is the
same as the element type of supplied empty array.
<p>
This is a <a href="package-summary.html#StreamOps">termin... | [
"Returns",
"an",
"array",
"containing",
"all",
"the",
"stream",
"elements",
".",
"If",
"the",
"stream",
"happens",
"to",
"contain",
"no",
"elements",
"the",
"supplied",
"empty",
"array",
"is",
"returned",
"instead",
".",
"Otherwise",
"the",
"new",
"array",
"... | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/StreamEx.java#L837-L844 |
117,212 | amaembo/streamex | src/main/java/one/util/streamex/StreamEx.java | StreamEx.toFlatCollection | public <U, C extends Collection<U>> C toFlatCollection(Function<? super T, ? extends Collection<U>> mapper,
Supplier<C> supplier) {
return map(mapper).collect(supplier, Collection::addAll, Collection::addAll);
} | java | public <U, C extends Collection<U>> C toFlatCollection(Function<? super T, ? extends Collection<U>> mapper,
Supplier<C> supplier) {
return map(mapper).collect(supplier, Collection::addAll, Collection::addAll);
} | [
"public",
"<",
"U",
",",
"C",
"extends",
"Collection",
"<",
"U",
">",
">",
"C",
"toFlatCollection",
"(",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"Collection",
"<",
"U",
">",
">",
"mapper",
",",
"Supplier",
"<",
"C",
">",
"supplier",
... | Returns a collection created by provided supplier function which contains
all the elements of the collections generated by provided mapper from
each element of this stream.
<p>
This is a <a href="package-summary.html#StreamOps">terminal</a>
operation.
<p>
This method is equivalent to
{@code flatCollection(mapper).toC... | [
"Returns",
"a",
"collection",
"created",
"by",
"provided",
"supplier",
"function",
"which",
"contains",
"all",
"the",
"elements",
"of",
"the",
"collections",
"generated",
"by",
"provided",
"mapper",
"from",
"each",
"element",
"of",
"this",
"stream",
"."
] | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/StreamEx.java#L871-L874 |
117,213 | amaembo/streamex | src/main/java/one/util/streamex/StreamEx.java | StreamEx.into | public <C extends Collection<? super T>> C into(C collection) {
if (isParallel()) {
@SuppressWarnings("unchecked")
List<T> list = Arrays.asList((T[]) toArray());
collection.addAll(list);
} else {
Spliterator<T> spltr = spliterator();
if (collec... | java | public <C extends Collection<? super T>> C into(C collection) {
if (isParallel()) {
@SuppressWarnings("unchecked")
List<T> list = Arrays.asList((T[]) toArray());
collection.addAll(list);
} else {
Spliterator<T> spltr = spliterator();
if (collec... | [
"public",
"<",
"C",
"extends",
"Collection",
"<",
"?",
"super",
"T",
">",
">",
"C",
"into",
"(",
"C",
"collection",
")",
"{",
"if",
"(",
"isParallel",
"(",
")",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"List",
"<",
"T",
">",
"l... | Drains the stream content into the supplied collection.
<p>
This is a <a href="package-summary.html#StreamOps">terminal</a>
operation.
<p>
The stream content is added into the collection using either
{@link Collection#add(Object)} or {@link Collection#addAll(Collection)}
method.
@param <C> type of the resulting coll... | [
"Drains",
"the",
"stream",
"content",
"into",
"the",
"supplied",
"collection",
"."
] | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/StreamEx.java#L1022-L1037 |
117,214 | amaembo/streamex | src/main/java/one/util/streamex/StreamEx.java | StreamEx.ifEmpty | @SafeVarargs
public final StreamEx<T> ifEmpty(T... values) {
return ifEmpty(null, Spliterators.spliterator(values, Spliterator.ORDERED));
} | java | @SafeVarargs
public final StreamEx<T> ifEmpty(T... values) {
return ifEmpty(null, Spliterators.spliterator(values, Spliterator.ORDERED));
} | [
"@",
"SafeVarargs",
"public",
"final",
"StreamEx",
"<",
"T",
">",
"ifEmpty",
"(",
"T",
"...",
"values",
")",
"{",
"return",
"ifEmpty",
"(",
"null",
",",
"Spliterators",
".",
"spliterator",
"(",
"values",
",",
"Spliterator",
".",
"ORDERED",
")",
")",
";",... | Returns a stream which contents is the same as this stream, except the case when
this stream is empty. In this case its contents is replaced with supplied values.
<p>
This is a <a href="package-summary.html#StreamOps">quasi-intermediate
operation</a>.
@param values values to replace the contents of this stream if thi... | [
"Returns",
"a",
"stream",
"which",
"contents",
"is",
"the",
"same",
"as",
"this",
"stream",
"except",
"the",
"case",
"when",
"this",
"stream",
"is",
"empty",
".",
"In",
"this",
"case",
"its",
"contents",
"is",
"replaced",
"with",
"supplied",
"values",
"."
... | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/StreamEx.java#L1387-L1390 |
117,215 | amaembo/streamex | src/main/java/one/util/streamex/StreamEx.java | StreamEx.without | public StreamEx<T> without(T value) {
if (value == null)
return filter(Objects::nonNull);
return remove(value::equals);
} | java | public StreamEx<T> without(T value) {
if (value == null)
return filter(Objects::nonNull);
return remove(value::equals);
} | [
"public",
"StreamEx",
"<",
"T",
">",
"without",
"(",
"T",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"return",
"filter",
"(",
"Objects",
"::",
"nonNull",
")",
";",
"return",
"remove",
"(",
"value",
"::",
"equals",
")",
";",
"}"
] | Returns a stream consisting of the elements of this stream that don't
equal to the given value.
<p>
This is an <a href="package-summary.html#StreamOps">intermediate</a>
operation.
@param value the value to remove from the stream. If the value is null
then all nulls will be removed (like {@link #nonNull()} works).
Oth... | [
"Returns",
"a",
"stream",
"consisting",
"of",
"the",
"elements",
"of",
"this",
"stream",
"that",
"don",
"t",
"equal",
"to",
"the",
"given",
"value",
"."
] | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/StreamEx.java#L1427-L1431 |
117,216 | amaembo/streamex | src/main/java/one/util/streamex/StreamEx.java | StreamEx.forPairs | public void forPairs(BiConsumer<? super T, ? super T> action) {
pairMap((a, b) -> {
action.accept(a, b);
return null;
}).reduce(null, selectFirst());
} | java | public void forPairs(BiConsumer<? super T, ? super T> action) {
pairMap((a, b) -> {
action.accept(a, b);
return null;
}).reduce(null, selectFirst());
} | [
"public",
"void",
"forPairs",
"(",
"BiConsumer",
"<",
"?",
"super",
"T",
",",
"?",
"super",
"T",
">",
"action",
")",
"{",
"pairMap",
"(",
"(",
"a",
",",
"b",
")",
"->",
"{",
"action",
".",
"accept",
"(",
"a",
",",
"b",
")",
";",
"return",
"null... | Performs an action for each adjacent pair of elements of this stream.
<p>
This is a <a href="package-summary.html#StreamOps">terminal</a>
operation.
<p>
The behavior of this operation is explicitly non-deterministic. For
parallel stream pipelines, this operation does <em>not</em> guarantee to
respect the encounter or... | [
"Performs",
"an",
"action",
"for",
"each",
"adjacent",
"pair",
"of",
"elements",
"of",
"this",
"stream",
"."
] | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/StreamEx.java#L1536-L1541 |
117,217 | amaembo/streamex | src/main/java/one/util/streamex/StreamEx.java | StreamEx.collapse | public StreamEx<T> collapse(BiPredicate<? super T, ? super T> collapsible) {
return collapse(collapsible, selectFirst());
} | java | public StreamEx<T> collapse(BiPredicate<? super T, ? super T> collapsible) {
return collapse(collapsible, selectFirst());
} | [
"public",
"StreamEx",
"<",
"T",
">",
"collapse",
"(",
"BiPredicate",
"<",
"?",
"super",
"T",
",",
"?",
"super",
"T",
">",
"collapsible",
")",
"{",
"return",
"collapse",
"(",
"collapsible",
",",
"selectFirst",
"(",
")",
")",
";",
"}"
] | Returns a stream consisting of elements of this stream where every series
of elements matched the predicate is replaced with first element from the
series.
<p>
This is a <a href="package-summary.html#StreamOps">quasi-intermediate</a>
partial reduction operation.
<p>
This operation is equivalent to
{@code collapse(col... | [
"Returns",
"a",
"stream",
"consisting",
"of",
"elements",
"of",
"this",
"stream",
"where",
"every",
"series",
"of",
"elements",
"matched",
"the",
"predicate",
"is",
"replaced",
"with",
"first",
"element",
"from",
"the",
"series",
"."
] | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/StreamEx.java#L1639-L1641 |
117,218 | amaembo/streamex | src/main/java/one/util/streamex/StreamEx.java | StreamEx.groupRuns | public StreamEx<List<T>> groupRuns(BiPredicate<? super T, ? super T> sameGroup) {
return collapseInternal(sameGroup, Collections::singletonList, (acc, t) -> {
if (!(acc instanceof ArrayList)) {
T old = acc.get(0);
acc = new ArrayList<>();
acc.add(old);... | java | public StreamEx<List<T>> groupRuns(BiPredicate<? super T, ? super T> sameGroup) {
return collapseInternal(sameGroup, Collections::singletonList, (acc, t) -> {
if (!(acc instanceof ArrayList)) {
T old = acc.get(0);
acc = new ArrayList<>();
acc.add(old);... | [
"public",
"StreamEx",
"<",
"List",
"<",
"T",
">",
">",
"groupRuns",
"(",
"BiPredicate",
"<",
"?",
"super",
"T",
",",
"?",
"super",
"T",
">",
"sameGroup",
")",
"{",
"return",
"collapseInternal",
"(",
"sameGroup",
",",
"Collections",
"::",
"singletonList",
... | Returns a stream consisting of lists of elements of this stream where
adjacent elements are grouped according to supplied predicate.
<p>
This is a <a href="package-summary.html#StreamOps">quasi-intermediate</a>
partial reduction operation.
<p>
There are no guarantees on the type, mutability, serializability, or
threa... | [
"Returns",
"a",
"stream",
"consisting",
"of",
"lists",
"of",
"elements",
"of",
"this",
"stream",
"where",
"adjacent",
"elements",
"are",
"grouped",
"according",
"to",
"supplied",
"predicate",
"."
] | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/StreamEx.java#L1693-L1711 |
117,219 | amaembo/streamex | src/main/java/one/util/streamex/StreamEx.java | StreamEx.intervalMap | public <U> StreamEx<U> intervalMap(BiPredicate<? super T, ? super T> sameInterval,
BiFunction<? super T, ? super T, ? extends U> mapper) {
return collapseInternal(sameInterval, PairBox::single, (box, t) -> {
box.b = t;
return box;
}, (left, right) -> {
lef... | java | public <U> StreamEx<U> intervalMap(BiPredicate<? super T, ? super T> sameInterval,
BiFunction<? super T, ? super T, ? extends U> mapper) {
return collapseInternal(sameInterval, PairBox::single, (box, t) -> {
box.b = t;
return box;
}, (left, right) -> {
lef... | [
"public",
"<",
"U",
">",
"StreamEx",
"<",
"U",
">",
"intervalMap",
"(",
"BiPredicate",
"<",
"?",
"super",
"T",
",",
"?",
"super",
"T",
">",
"sameInterval",
",",
"BiFunction",
"<",
"?",
"super",
"T",
",",
"?",
"super",
"T",
",",
"?",
"extends",
"U",... | Returns a stream consisting of results of applying the given function to
the intervals created from the source elements.
<p>
This is a <a href="package-summary.html#StreamOps">quasi-intermediate</a>
partial reduction operation. This operation is the same as
{@code groupRuns(sameInterval).map(list -> mapper.apply(list.... | [
"Returns",
"a",
"stream",
"consisting",
"of",
"results",
"of",
"applying",
"the",
"given",
"function",
"to",
"the",
"intervals",
"created",
"from",
"the",
"source",
"elements",
"."
] | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/StreamEx.java#L1741-L1750 |
117,220 | amaembo/streamex | src/main/java/one/util/streamex/StreamEx.java | StreamEx.withFirst | public <R> StreamEx<R> withFirst(BiFunction<? super T, ? super T, ? extends R> mapper) {
WithFirstSpliterator<T, R> spliterator = new WithFirstSpliterator<>(spliterator(), mapper);
return new StreamEx<>(spliterator, context);
} | java | public <R> StreamEx<R> withFirst(BiFunction<? super T, ? super T, ? extends R> mapper) {
WithFirstSpliterator<T, R> spliterator = new WithFirstSpliterator<>(spliterator(), mapper);
return new StreamEx<>(spliterator, context);
} | [
"public",
"<",
"R",
">",
"StreamEx",
"<",
"R",
">",
"withFirst",
"(",
"BiFunction",
"<",
"?",
"super",
"T",
",",
"?",
"super",
"T",
",",
"?",
"extends",
"R",
">",
"mapper",
")",
"{",
"WithFirstSpliterator",
"<",
"T",
",",
"R",
">",
"spliterator",
"... | Returns a stream consisting of the results of applying the given function
to the the first element and every other element of this stream.
<p>
This is a <a href="package-summary.html#StreamOps">quasi-intermediate
operation</a>.
<p>
The size of the resulting stream is one element less than the input
stream. If the inp... | [
"Returns",
"a",
"stream",
"consisting",
"of",
"the",
"results",
"of",
"applying",
"the",
"given",
"function",
"to",
"the",
"the",
"first",
"element",
"and",
"every",
"other",
"element",
"of",
"this",
"stream",
"."
] | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/StreamEx.java#L1773-L1776 |
117,221 | amaembo/streamex | src/main/java/one/util/streamex/StreamEx.java | StreamEx.split | public static StreamEx<String> split(CharSequence str, Pattern pattern) {
if (str.length() == 0)
return of("");
return new StreamEx<>(pattern.splitAsStream(str), StreamContext.SEQUENTIAL);
} | java | public static StreamEx<String> split(CharSequence str, Pattern pattern) {
if (str.length() == 0)
return of("");
return new StreamEx<>(pattern.splitAsStream(str), StreamContext.SEQUENTIAL);
} | [
"public",
"static",
"StreamEx",
"<",
"String",
">",
"split",
"(",
"CharSequence",
"str",
",",
"Pattern",
"pattern",
")",
"{",
"if",
"(",
"str",
".",
"length",
"(",
")",
"==",
"0",
")",
"return",
"of",
"(",
"\"\"",
")",
";",
"return",
"new",
"StreamEx... | Creates a stream from the given input sequence around matches of the
given pattern.
<p>
The stream returned by this method contains each substring of the input
sequence that is terminated by another subsequence that matches this
pattern or is terminated by the end of the input sequence. The substrings
in the stream ar... | [
"Creates",
"a",
"stream",
"from",
"the",
"given",
"input",
"sequence",
"around",
"matches",
"of",
"the",
"given",
"pattern",
"."
] | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/StreamEx.java#L2563-L2567 |
117,222 | amaembo/streamex | src/main/java/one/util/streamex/StreamEx.java | StreamEx.split | public static StreamEx<String> split(CharSequence str, String regex) {
if (str.length() == 0)
return of("");
if (regex.isEmpty()) {
return IntStreamEx.ofChars(str).mapToObj(ch -> new String(new char[] { (char) ch }));
}
char ch = regex.charAt(0);
if (regex... | java | public static StreamEx<String> split(CharSequence str, String regex) {
if (str.length() == 0)
return of("");
if (regex.isEmpty()) {
return IntStreamEx.ofChars(str).mapToObj(ch -> new String(new char[] { (char) ch }));
}
char ch = regex.charAt(0);
if (regex... | [
"public",
"static",
"StreamEx",
"<",
"String",
">",
"split",
"(",
"CharSequence",
"str",
",",
"String",
"regex",
")",
"{",
"if",
"(",
"str",
".",
"length",
"(",
")",
"==",
"0",
")",
"return",
"of",
"(",
"\"\"",
")",
";",
"if",
"(",
"regex",
".",
... | Creates a stream from the given input sequence around matches of the
given pattern represented as String.
<p>
This method is equivalent to
{@code StreamEx.split(str, Pattern.compile(regex))}.
@param str The character sequence to be split
@param regex The regular expression String to use for splitting
@return The str... | [
"Creates",
"a",
"stream",
"from",
"the",
"given",
"input",
"sequence",
"around",
"matches",
"of",
"the",
"given",
"pattern",
"represented",
"as",
"String",
"."
] | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/StreamEx.java#L2585-L2602 |
117,223 | amaembo/streamex | src/main/java/one/util/streamex/Limiter.java | Limiter.put | public boolean put(T t) {
if (initial) {
if (size == data.length) {
if (size < limit * 2) {
@SuppressWarnings("unchecked")
T[] newData = (T[]) new Object[Math.min(limit, size) * 2];
System.arraycopy(data, 0, newData, 0... | java | public boolean put(T t) {
if (initial) {
if (size == data.length) {
if (size < limit * 2) {
@SuppressWarnings("unchecked")
T[] newData = (T[]) new Object[Math.min(limit, size) * 2];
System.arraycopy(data, 0, newData, 0... | [
"public",
"boolean",
"put",
"(",
"T",
"t",
")",
"{",
"if",
"(",
"initial",
")",
"{",
"if",
"(",
"size",
"==",
"data",
".",
"length",
")",
"{",
"if",
"(",
"size",
"<",
"limit",
"*",
"2",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")"... | Accumulate new element
@param t element to accumulate
@return false if the element is definitely not included into result, so
any bigger element could be skipped as well, or true if element
will probably be included into result. | [
"Accumulate",
"new",
"element"
] | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/Limiter.java#L55-L82 |
117,224 | amaembo/streamex | src/main/java/one/util/streamex/AbstractStreamEx.java | AbstractStreamEx.mapPartial | public <R> StreamEx<R> mapPartial(Function<? super T, ? extends Optional<? extends R>> mapper) {
return new StreamEx<>(stream().map(value -> mapper.apply(value).orElse(null)).filter(Objects::nonNull),
context);
} | java | public <R> StreamEx<R> mapPartial(Function<? super T, ? extends Optional<? extends R>> mapper) {
return new StreamEx<>(stream().map(value -> mapper.apply(value).orElse(null)).filter(Objects::nonNull),
context);
} | [
"public",
"<",
"R",
">",
"StreamEx",
"<",
"R",
">",
"mapPartial",
"(",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"Optional",
"<",
"?",
"extends",
"R",
">",
">",
"mapper",
")",
"{",
"return",
"new",
"StreamEx",
"<>",
"(",
"stream",
"(... | Performs a mapping of the stream content to a partial function
removing the elements to which the function is not applicable.
<p>
If the mapping function returns {@link Optional#empty()}, the original
value will be removed from the resulting stream. The mapping function
may not return null.
<p>
This is an <a href="pa... | [
"Performs",
"a",
"mapping",
"of",
"the",
"stream",
"content",
"to",
"a",
"partial",
"function",
"removing",
"the",
"elements",
"to",
"which",
"the",
"function",
"is",
"not",
"applicable",
"."
] | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/AbstractStreamEx.java#L619-L622 |
117,225 | amaembo/streamex | src/main/java/one/util/streamex/AbstractStreamEx.java | AbstractStreamEx.minByLong | public Optional<T> minByLong(ToLongFunction<? super T> keyExtractor) {
return Box
.asOptional(reduce(null, (ObjLongBox<T> acc, T t) -> {
long val = keyExtractor.applyAsLong(t);
if (acc == null)
return new ObjLongBox<>(t, val);
... | java | public Optional<T> minByLong(ToLongFunction<? super T> keyExtractor) {
return Box
.asOptional(reduce(null, (ObjLongBox<T> acc, T t) -> {
long val = keyExtractor.applyAsLong(t);
if (acc == null)
return new ObjLongBox<>(t, val);
... | [
"public",
"Optional",
"<",
"T",
">",
"minByLong",
"(",
"ToLongFunction",
"<",
"?",
"super",
"T",
">",
"keyExtractor",
")",
"{",
"return",
"Box",
".",
"asOptional",
"(",
"reduce",
"(",
"null",
",",
"(",
"ObjLongBox",
"<",
"T",
">",
"acc",
",",
"T",
"t... | Returns the minimum element of this stream according to the long values
extracted by provided function. This is a special case of a reduction.
<p>
This is a terminal operation.
<p>
This method is equivalent to
{@code min(Comparator.comparingLong(keyExtractor))}, but may work faster
as keyExtractor function is applied... | [
"Returns",
"the",
"minimum",
"element",
"of",
"this",
"stream",
"according",
"to",
"the",
"long",
"values",
"extracted",
"by",
"provided",
"function",
".",
"This",
"is",
"a",
"special",
"case",
"of",
"a",
"reduction",
"."
] | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/AbstractStreamEx.java#L911-L924 |
117,226 | amaembo/streamex | src/main/java/one/util/streamex/AbstractStreamEx.java | AbstractStreamEx.minByDouble | public Optional<T> minByDouble(ToDoubleFunction<? super T> keyExtractor) {
return Box.asOptional(reduce(null, (ObjDoubleBox<T> acc, T t) -> {
double val = keyExtractor.applyAsDouble(t);
if (acc == null)
return new ObjDoubleBox<>(t, val);
if (Double.compare(val... | java | public Optional<T> minByDouble(ToDoubleFunction<? super T> keyExtractor) {
return Box.asOptional(reduce(null, (ObjDoubleBox<T> acc, T t) -> {
double val = keyExtractor.applyAsDouble(t);
if (acc == null)
return new ObjDoubleBox<>(t, val);
if (Double.compare(val... | [
"public",
"Optional",
"<",
"T",
">",
"minByDouble",
"(",
"ToDoubleFunction",
"<",
"?",
"super",
"T",
">",
"keyExtractor",
")",
"{",
"return",
"Box",
".",
"asOptional",
"(",
"reduce",
"(",
"null",
",",
"(",
"ObjDoubleBox",
"<",
"T",
">",
"acc",
",",
"T"... | Returns the minimum element of this stream according to the double values
extracted by provided function. This is a special case of a reduction.
<p>
This is a terminal operation.
<p>
This method is equivalent to
{@code min(Comparator.comparingDouble(keyExtractor))}, but may work
faster as keyExtractor function is app... | [
"Returns",
"the",
"minimum",
"element",
"of",
"this",
"stream",
"according",
"to",
"the",
"double",
"values",
"extracted",
"by",
"provided",
"function",
".",
"This",
"is",
"a",
"special",
"case",
"of",
"a",
"reduction",
"."
] | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/AbstractStreamEx.java#L947-L959 |
117,227 | amaembo/streamex | src/main/java/one/util/streamex/AbstractStreamEx.java | AbstractStreamEx.maxBy | public <V extends Comparable<? super V>> Optional<T> maxBy(Function<? super T, ? extends V> keyExtractor) {
return Box
.asOptional(reduce(null, (PairBox<T, V> acc, T t) -> {
V val = keyExtractor.apply(t);
if (acc == null)
return new... | java | public <V extends Comparable<? super V>> Optional<T> maxBy(Function<? super T, ? extends V> keyExtractor) {
return Box
.asOptional(reduce(null, (PairBox<T, V> acc, T t) -> {
V val = keyExtractor.apply(t);
if (acc == null)
return new... | [
"public",
"<",
"V",
"extends",
"Comparable",
"<",
"?",
"super",
"V",
">",
">",
"Optional",
"<",
"T",
">",
"maxBy",
"(",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"V",
">",
"keyExtractor",
")",
"{",
"return",
"Box",
".",
"asOptional",
... | Returns the maximum element of this stream according to the natural order
of the keys extracted by provided function. This is a special case of a
reduction.
<p>
This is a terminal operation.
<p>
This method is equivalent to
{@code max(Comparator.comparing(keyExtractor))}, but may work faster as
keyExtractor function ... | [
"Returns",
"the",
"maximum",
"element",
"of",
"this",
"stream",
"according",
"to",
"the",
"natural",
"order",
"of",
"the",
"keys",
"extracted",
"by",
"provided",
"function",
".",
"This",
"is",
"a",
"special",
"case",
"of",
"a",
"reduction",
"."
] | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/AbstractStreamEx.java#L983-L996 |
117,228 | amaembo/streamex | src/main/java/one/util/streamex/AbstractStreamEx.java | AbstractStreamEx.maxByInt | public Optional<T> maxByInt(ToIntFunction<? super T> keyExtractor) {
return Box.asOptional(reduce(null, (ObjIntBox<T> acc, T t) -> {
int val = keyExtractor.applyAsInt(t);
if (acc == null)
return new ObjIntBox<>(t, val);
if (val > acc.b) {
acc.b... | java | public Optional<T> maxByInt(ToIntFunction<? super T> keyExtractor) {
return Box.asOptional(reduce(null, (ObjIntBox<T> acc, T t) -> {
int val = keyExtractor.applyAsInt(t);
if (acc == null)
return new ObjIntBox<>(t, val);
if (val > acc.b) {
acc.b... | [
"public",
"Optional",
"<",
"T",
">",
"maxByInt",
"(",
"ToIntFunction",
"<",
"?",
"super",
"T",
">",
"keyExtractor",
")",
"{",
"return",
"Box",
".",
"asOptional",
"(",
"reduce",
"(",
"null",
",",
"(",
"ObjIntBox",
"<",
"T",
">",
"acc",
",",
"T",
"t",
... | Returns the maximum element of this stream according to the int values
extracted by provided function. This is a special case of a reduction.
<p>
This is a terminal operation.
<p>
This method is equivalent to
{@code max(Comparator.comparingInt(keyExtractor))}, but may work faster
as keyExtractor function is applied o... | [
"Returns",
"the",
"maximum",
"element",
"of",
"this",
"stream",
"according",
"to",
"the",
"int",
"values",
"extracted",
"by",
"provided",
"function",
".",
"This",
"is",
"a",
"special",
"case",
"of",
"a",
"reduction",
"."
] | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/AbstractStreamEx.java#L1018-L1029 |
117,229 | amaembo/streamex | src/main/java/one/util/streamex/AbstractStreamEx.java | AbstractStreamEx.foldRight | public <U> U foldRight(U seed, BiFunction<? super T, U, U> accumulator) {
return toListAndThen(list -> {
U result = seed;
for (int i = list.size() - 1; i >= 0; i--)
result = accumulator.apply(list.get(i), result);
return result;
});
} | java | public <U> U foldRight(U seed, BiFunction<? super T, U, U> accumulator) {
return toListAndThen(list -> {
U result = seed;
for (int i = list.size() - 1; i >= 0; i--)
result = accumulator.apply(list.get(i), result);
return result;
});
} | [
"public",
"<",
"U",
">",
"U",
"foldRight",
"(",
"U",
"seed",
",",
"BiFunction",
"<",
"?",
"super",
"T",
",",
"U",
",",
"U",
">",
"accumulator",
")",
"{",
"return",
"toListAndThen",
"(",
"list",
"->",
"{",
"U",
"result",
"=",
"seed",
";",
"for",
"... | Folds the elements of this stream using the provided seed object and
accumulation function, going right to left.
<p>
This is a terminal operation.
<p>
As this method must process elements strictly right to left, it cannot
start processing till all the previous stream stages complete. Also it
requires intermediate mem... | [
"Folds",
"the",
"elements",
"of",
"this",
"stream",
"using",
"the",
"provided",
"seed",
"object",
"and",
"accumulation",
"function",
"going",
"right",
"to",
"left",
"."
] | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/AbstractStreamEx.java#L1437-L1444 |
117,230 | amaembo/streamex | src/main/java/one/util/streamex/AbstractStreamEx.java | AbstractStreamEx.foldRight | public Optional<T> foldRight(BinaryOperator<T> accumulator) {
return toListAndThen(list -> {
if (list.isEmpty())
return Optional.empty();
int i = list.size() - 1;
T result = list.get(i--);
for (; i >= 0; i--)
result = accumulator.ap... | java | public Optional<T> foldRight(BinaryOperator<T> accumulator) {
return toListAndThen(list -> {
if (list.isEmpty())
return Optional.empty();
int i = list.size() - 1;
T result = list.get(i--);
for (; i >= 0; i--)
result = accumulator.ap... | [
"public",
"Optional",
"<",
"T",
">",
"foldRight",
"(",
"BinaryOperator",
"<",
"T",
">",
"accumulator",
")",
"{",
"return",
"toListAndThen",
"(",
"list",
"->",
"{",
"if",
"(",
"list",
".",
"isEmpty",
"(",
")",
")",
"return",
"Optional",
".",
"empty",
"(... | Folds the elements of this stream using the provided accumulation
function, going right to left.
<p>
This is a terminal operation.
<p>
As this method must process elements strictly right to left, it cannot
start processing till all the previous stream stages complete. Also it
requires intermediate memory to store the... | [
"Folds",
"the",
"elements",
"of",
"this",
"stream",
"using",
"the",
"provided",
"accumulation",
"function",
"going",
"right",
"to",
"left",
"."
] | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/AbstractStreamEx.java#L1474-L1484 |
117,231 | amaembo/streamex | src/main/java/one/util/streamex/AbstractStreamEx.java | AbstractStreamEx.scanLeft | public <U> List<U> scanLeft(U seed, BiFunction<U, ? super T, U> accumulator) {
List<U> result = new ArrayList<>();
result.add(seed);
forEachOrdered(t -> result.add(accumulator.apply(result.get(result.size() - 1), t)));
return result;
} | java | public <U> List<U> scanLeft(U seed, BiFunction<U, ? super T, U> accumulator) {
List<U> result = new ArrayList<>();
result.add(seed);
forEachOrdered(t -> result.add(accumulator.apply(result.get(result.size() - 1), t)));
return result;
} | [
"public",
"<",
"U",
">",
"List",
"<",
"U",
">",
"scanLeft",
"(",
"U",
"seed",
",",
"BiFunction",
"<",
"U",
",",
"?",
"super",
"T",
",",
"U",
">",
"accumulator",
")",
"{",
"List",
"<",
"U",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
")",... | Produces a list containing cumulative results of applying the
accumulation function going left to right using given seed value.
<p>
This is a terminal operation.
<p>
The resulting {@link List} is guaranteed to be mutable.
<p>
For parallel stream it's not guaranteed that accumulator will always be
executed in the sam... | [
"Produces",
"a",
"list",
"containing",
"cumulative",
"results",
"of",
"applying",
"the",
"accumulation",
"function",
"going",
"left",
"to",
"right",
"using",
"given",
"seed",
"value",
"."
] | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/AbstractStreamEx.java#L1519-L1524 |
117,232 | amaembo/streamex | src/main/java/one/util/streamex/AbstractStreamEx.java | AbstractStreamEx.scanLeft | public List<T> scanLeft(BinaryOperator<T> accumulator) {
List<T> result = new ArrayList<>();
forEachOrdered(t -> {
if (result.isEmpty())
result.add(t);
else
result.add(accumulator.apply(result.get(result.size() - 1), t));
});
return... | java | public List<T> scanLeft(BinaryOperator<T> accumulator) {
List<T> result = new ArrayList<>();
forEachOrdered(t -> {
if (result.isEmpty())
result.add(t);
else
result.add(accumulator.apply(result.get(result.size() - 1), t));
});
return... | [
"public",
"List",
"<",
"T",
">",
"scanLeft",
"(",
"BinaryOperator",
"<",
"T",
">",
"accumulator",
")",
"{",
"List",
"<",
"T",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"forEachOrdered",
"(",
"t",
"->",
"{",
"if",
"(",
"result",
"... | Produces a list containing cumulative results of applying the
accumulation function going left to right.
<p>
This is a terminal operation.
<p>
The resulting {@link List} is guaranteed to be mutable.
<p>
For parallel stream it's not guaranteed that accumulator will always be
executed in the same thread.
<p>
This met... | [
"Produces",
"a",
"list",
"containing",
"cumulative",
"results",
"of",
"applying",
"the",
"accumulation",
"function",
"going",
"left",
"to",
"right",
"."
] | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/AbstractStreamEx.java#L1558-L1567 |
117,233 | amaembo/streamex | src/main/java/one/util/streamex/AbstractStreamEx.java | AbstractStreamEx.scanRight | @SuppressWarnings("unchecked")
public <U> List<U> scanRight(U seed, BiFunction<? super T, U, U> accumulator) {
return toListAndThen(list -> {
// Reusing the list for different object type as it will save memory
List<U> result = (List<U>) list;
result.add(seed);
... | java | @SuppressWarnings("unchecked")
public <U> List<U> scanRight(U seed, BiFunction<? super T, U, U> accumulator) {
return toListAndThen(list -> {
// Reusing the list for different object type as it will save memory
List<U> result = (List<U>) list;
result.add(seed);
... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"U",
">",
"List",
"<",
"U",
">",
"scanRight",
"(",
"U",
"seed",
",",
"BiFunction",
"<",
"?",
"super",
"T",
",",
"U",
",",
"U",
">",
"accumulator",
")",
"{",
"return",
"toListAndThen",
... | Produces a list containing cumulative results of applying the
accumulation function going right to left using given seed value.
<p>
This is a terminal operation.
<p>
The resulting {@link List} is guaranteed to be mutable.
<p>
For parallel stream it's not guaranteed that accumulator will always be
executed in the sam... | [
"Produces",
"a",
"list",
"containing",
"cumulative",
"results",
"of",
"applying",
"the",
"accumulation",
"function",
"going",
"right",
"to",
"left",
"using",
"given",
"seed",
"value",
"."
] | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/AbstractStreamEx.java#L1602-L1613 |
117,234 | amaembo/streamex | src/main/java/one/util/streamex/AbstractStreamEx.java | AbstractStreamEx.scanRight | public List<T> scanRight(BinaryOperator<T> accumulator) {
return toListAndThen(list -> {
for (int i = list.size() - 2; i >= 0; i--) {
list.set(i, accumulator.apply(list.get(i), list.get(i + 1)));
}
return list;
});
} | java | public List<T> scanRight(BinaryOperator<T> accumulator) {
return toListAndThen(list -> {
for (int i = list.size() - 2; i >= 0; i--) {
list.set(i, accumulator.apply(list.get(i), list.get(i + 1)));
}
return list;
});
} | [
"public",
"List",
"<",
"T",
">",
"scanRight",
"(",
"BinaryOperator",
"<",
"T",
">",
"accumulator",
")",
"{",
"return",
"toListAndThen",
"(",
"list",
"->",
"{",
"for",
"(",
"int",
"i",
"=",
"list",
".",
"size",
"(",
")",
"-",
"2",
";",
"i",
">=",
... | Produces a collection containing cumulative results of applying the
accumulation function going right to left.
<p>
This is a terminal operation.
<p>
The result {@link List} is guaranteed to be mutable.
<p>
For parallel stream it's not guaranteed that accumulator will always be
executed in the same thread.
<p>
This ... | [
"Produces",
"a",
"collection",
"containing",
"cumulative",
"results",
"of",
"applying",
"the",
"accumulation",
"function",
"going",
"right",
"to",
"left",
"."
] | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/AbstractStreamEx.java#L1646-L1653 |
117,235 | amaembo/streamex | src/main/java/one/util/streamex/AbstractStreamEx.java | AbstractStreamEx.prefix | public S prefix(BinaryOperator<T> op) {
Spliterator<T> spltr = spliterator();
return supply(spltr.hasCharacteristics(Spliterator.ORDERED) ? new PrefixOps.OfRef<>(spltr, op)
: new PrefixOps.OfUnordRef<T>(spltr, op));
} | java | public S prefix(BinaryOperator<T> op) {
Spliterator<T> spltr = spliterator();
return supply(spltr.hasCharacteristics(Spliterator.ORDERED) ? new PrefixOps.OfRef<>(spltr, op)
: new PrefixOps.OfUnordRef<T>(spltr, op));
} | [
"public",
"S",
"prefix",
"(",
"BinaryOperator",
"<",
"T",
">",
"op",
")",
"{",
"Spliterator",
"<",
"T",
">",
"spltr",
"=",
"spliterator",
"(",
")",
";",
"return",
"supply",
"(",
"spltr",
".",
"hasCharacteristics",
"(",
"Spliterator",
".",
"ORDERED",
")",... | Returns a stream containing cumulative results of applying the
accumulation function going left to right.
<p>
This is a stateful <a
href="package-summary.html#StreamOps">quasi-intermediate</a> operation.
<p>
This operation resembles {@link #scanLeft(BinaryOperator)}, but unlike
{@code scanLeft} this operation is inte... | [
"Returns",
"a",
"stream",
"containing",
"cumulative",
"results",
"of",
"applying",
"the",
"accumulation",
"function",
"going",
"left",
"to",
"right",
"."
] | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/AbstractStreamEx.java#L1769-L1773 |
117,236 | amaembo/streamex | src/main/java/one/util/streamex/AbstractStreamEx.java | AbstractStreamEx.chain | @SuppressWarnings("unchecked")
@Override
public <U> U chain(Function<? super S, U> mapper) {
return mapper.apply((S)this);
} | java | @SuppressWarnings("unchecked")
@Override
public <U> U chain(Function<? super S, U> mapper) {
return mapper.apply((S)this);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"Override",
"public",
"<",
"U",
">",
"U",
"chain",
"(",
"Function",
"<",
"?",
"super",
"S",
",",
"U",
">",
"mapper",
")",
"{",
"return",
"mapper",
".",
"apply",
"(",
"(",
"S",
")",
"this",
")... | Necessary to generate proper JavaDoc | [
"Necessary",
"to",
"generate",
"proper",
"JavaDoc"
] | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/AbstractStreamEx.java#L1776-L1780 |
117,237 | amaembo/streamex | src/main/java/one/util/streamex/CollapseSpliterator.java | CollapseSpliterator.connectEmpty | private R connectEmpty() {
synchronized (root) {
Connector<T, R> l = left, r = right;
if (l == null) {
return pushRight(none(), none());
}
left = right = null;
l.rhs = null;
T laright = l.right;
l.right ... | java | private R connectEmpty() {
synchronized (root) {
Connector<T, R> l = left, r = right;
if (l == null) {
return pushRight(none(), none());
}
left = right = null;
l.rhs = null;
T laright = l.right;
l.right ... | [
"private",
"R",
"connectEmpty",
"(",
")",
"{",
"synchronized",
"(",
"root",
")",
"{",
"Connector",
"<",
"T",
",",
"R",
">",
"l",
"=",
"left",
",",
"r",
"=",
"right",
";",
"if",
"(",
"l",
"==",
"null",
")",
"{",
"return",
"pushRight",
"(",
"none",... | l + r | [
"l",
"+",
"r"
] | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/CollapseSpliterator.java#L277-L334 |
117,238 | amaembo/streamex | src/main/java/one/util/streamex/EntryStream.java | EntryStream.mapKeyValuePartial | public <R> StreamEx<R> mapKeyValuePartial(
BiFunction<? super K, ? super V, ? extends Optional<? extends R>> mapper
) {
return mapPartial(toFunction(mapper));
} | java | public <R> StreamEx<R> mapKeyValuePartial(
BiFunction<? super K, ? super V, ? extends Optional<? extends R>> mapper
) {
return mapPartial(toFunction(mapper));
} | [
"public",
"<",
"R",
">",
"StreamEx",
"<",
"R",
">",
"mapKeyValuePartial",
"(",
"BiFunction",
"<",
"?",
"super",
"K",
",",
"?",
"super",
"V",
",",
"?",
"extends",
"Optional",
"<",
"?",
"extends",
"R",
">",
">",
"mapper",
")",
"{",
"return",
"mapPartia... | Performs a mapping of the stream keys and values to a partial function
removing the elements to which the function is not applicable.
<p>
If the mapping function returns {@link Optional#empty()}, the original
entry will be removed from the resulting stream. The mapping function
may not return null.
<p>
This is an <a ... | [
"Performs",
"a",
"mapping",
"of",
"the",
"stream",
"keys",
"and",
"values",
"to",
"a",
"partial",
"function",
"removing",
"the",
"elements",
"to",
"which",
"the",
"function",
"is",
"not",
"applicable",
"."
] | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/EntryStream.java#L549-L553 |
117,239 | amaembo/streamex | src/main/java/one/util/streamex/EntryStream.java | EntryStream.filterKeys | public EntryStream<K, V> filterKeys(Predicate<? super K> keyPredicate) {
return filter(e -> keyPredicate.test(e.getKey()));
} | java | public EntryStream<K, V> filterKeys(Predicate<? super K> keyPredicate) {
return filter(e -> keyPredicate.test(e.getKey()));
} | [
"public",
"EntryStream",
"<",
"K",
",",
"V",
">",
"filterKeys",
"(",
"Predicate",
"<",
"?",
"super",
"K",
">",
"keyPredicate",
")",
"{",
"return",
"filter",
"(",
"e",
"->",
"keyPredicate",
".",
"test",
"(",
"e",
".",
"getKey",
"(",
")",
")",
")",
"... | Returns a stream consisting of the elements of this stream which keys
match the given predicate.
<p>
This is an <a href="package-summary.html#StreamOps">intermediate</a>
operation.
@param keyPredicate a non-interfering, stateless predicate to apply to
the key of each element to determine if it should be included
@ret... | [
"Returns",
"a",
"stream",
"consisting",
"of",
"the",
"elements",
"of",
"this",
"stream",
"which",
"keys",
"match",
"the",
"given",
"predicate",
"."
] | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/EntryStream.java#L693-L695 |
117,240 | amaembo/streamex | src/main/java/one/util/streamex/EntryStream.java | EntryStream.filterValues | public EntryStream<K, V> filterValues(Predicate<? super V> valuePredicate) {
return filter(e -> valuePredicate.test(e.getValue()));
} | java | public EntryStream<K, V> filterValues(Predicate<? super V> valuePredicate) {
return filter(e -> valuePredicate.test(e.getValue()));
} | [
"public",
"EntryStream",
"<",
"K",
",",
"V",
">",
"filterValues",
"(",
"Predicate",
"<",
"?",
"super",
"V",
">",
"valuePredicate",
")",
"{",
"return",
"filter",
"(",
"e",
"->",
"valuePredicate",
".",
"test",
"(",
"e",
".",
"getValue",
"(",
")",
")",
... | Returns a stream consisting of the elements of this stream which values
match the given predicate.
<p>
This is an <a href="package-summary.html#StreamOps">intermediate</a>
operation.
@param valuePredicate a non-interfering, stateless predicate to apply to
the value of each element to determine if it should be include... | [
"Returns",
"a",
"stream",
"consisting",
"of",
"the",
"elements",
"of",
"this",
"stream",
"which",
"values",
"match",
"the",
"given",
"predicate",
"."
] | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/EntryStream.java#L709-L711 |
117,241 | amaembo/streamex | src/main/java/one/util/streamex/EntryStream.java | EntryStream.filterKeyValue | public EntryStream<K, V> filterKeyValue(BiPredicate<? super K, ? super V> predicate) {
return filter(e -> predicate.test(e.getKey(), e.getValue()));
} | java | public EntryStream<K, V> filterKeyValue(BiPredicate<? super K, ? super V> predicate) {
return filter(e -> predicate.test(e.getKey(), e.getValue()));
} | [
"public",
"EntryStream",
"<",
"K",
",",
"V",
">",
"filterKeyValue",
"(",
"BiPredicate",
"<",
"?",
"super",
"K",
",",
"?",
"super",
"V",
">",
"predicate",
")",
"{",
"return",
"filter",
"(",
"e",
"->",
"predicate",
".",
"test",
"(",
"e",
".",
"getKey",... | Returns a stream consisting of the elements of this stream which elements
match the given predicate.
<p>
This is an <a href="package-summary.html#StreamOps">intermediate</a>
operation.
@param predicate a non-interfering, stateless predicate to apply to the
key-value pairs of each element to determine if it should be
... | [
"Returns",
"a",
"stream",
"consisting",
"of",
"the",
"elements",
"of",
"this",
"stream",
"which",
"elements",
"match",
"the",
"given",
"predicate",
"."
] | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/EntryStream.java#L727-L729 |
117,242 | amaembo/streamex | src/main/java/one/util/streamex/EntryStream.java | EntryStream.removeKeys | public EntryStream<K, V> removeKeys(Predicate<? super K> keyPredicate) {
return filterKeys(keyPredicate.negate());
} | java | public EntryStream<K, V> removeKeys(Predicate<? super K> keyPredicate) {
return filterKeys(keyPredicate.negate());
} | [
"public",
"EntryStream",
"<",
"K",
",",
"V",
">",
"removeKeys",
"(",
"Predicate",
"<",
"?",
"super",
"K",
">",
"keyPredicate",
")",
"{",
"return",
"filterKeys",
"(",
"keyPredicate",
".",
"negate",
"(",
")",
")",
";",
"}"
] | Returns a stream consisting of the elements of this stream which keys
don't match the given predicate.
<p>
This is an <a href="package-summary.html#StreamOps">intermediate</a>
operation.
@param keyPredicate a non-interfering, stateless predicate to apply to
the key of each element to determine if it should be exclude... | [
"Returns",
"a",
"stream",
"consisting",
"of",
"the",
"elements",
"of",
"this",
"stream",
"which",
"keys",
"don",
"t",
"match",
"the",
"given",
"predicate",
"."
] | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/EntryStream.java#L743-L745 |
117,243 | amaembo/streamex | src/main/java/one/util/streamex/EntryStream.java | EntryStream.peekKeys | public EntryStream<K, V> peekKeys(Consumer<? super K> keyAction) {
return peek(e -> keyAction.accept(e.getKey()));
} | java | public EntryStream<K, V> peekKeys(Consumer<? super K> keyAction) {
return peek(e -> keyAction.accept(e.getKey()));
} | [
"public",
"EntryStream",
"<",
"K",
",",
"V",
">",
"peekKeys",
"(",
"Consumer",
"<",
"?",
"super",
"K",
">",
"keyAction",
")",
"{",
"return",
"peek",
"(",
"e",
"->",
"keyAction",
".",
"accept",
"(",
"e",
".",
"getKey",
"(",
")",
")",
")",
";",
"}"... | Returns a stream consisting of the entries of this stream, additionally
performing the provided action on each entry key as entries are consumed
from the resulting stream.
<p>
This is an <a href="package-summary.html#StreamOps">intermediate</a>
operation.
<p>
For parallel stream pipelines, the action may be called at... | [
"Returns",
"a",
"stream",
"consisting",
"of",
"the",
"entries",
"of",
"this",
"stream",
"additionally",
"performing",
"the",
"provided",
"action",
"on",
"each",
"entry",
"key",
"as",
"entries",
"are",
"consumed",
"from",
"the",
"resulting",
"stream",
"."
] | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/EntryStream.java#L863-L865 |
117,244 | amaembo/streamex | src/main/java/one/util/streamex/EntryStream.java | EntryStream.peekValues | public EntryStream<K, V> peekValues(Consumer<? super V> valueAction) {
return peek(e -> valueAction.accept(e.getValue()));
} | java | public EntryStream<K, V> peekValues(Consumer<? super V> valueAction) {
return peek(e -> valueAction.accept(e.getValue()));
} | [
"public",
"EntryStream",
"<",
"K",
",",
"V",
">",
"peekValues",
"(",
"Consumer",
"<",
"?",
"super",
"V",
">",
"valueAction",
")",
"{",
"return",
"peek",
"(",
"e",
"->",
"valueAction",
".",
"accept",
"(",
"e",
".",
"getValue",
"(",
")",
")",
")",
";... | Returns a stream consisting of the entries of this stream, additionally
performing the provided action on each entry value as entries are
consumed from the resulting stream.
<p>
This is an <a href="package-summary.html#StreamOps">intermediate</a>
operation.
<p>
For parallel stream pipelines, the action may be called ... | [
"Returns",
"a",
"stream",
"consisting",
"of",
"the",
"entries",
"of",
"this",
"stream",
"additionally",
"performing",
"the",
"provided",
"action",
"on",
"each",
"entry",
"value",
"as",
"entries",
"are",
"consumed",
"from",
"the",
"resulting",
"stream",
"."
] | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/EntryStream.java#L887-L889 |
117,245 | amaembo/streamex | src/main/java/one/util/streamex/EntryStream.java | EntryStream.peekKeyValue | public EntryStream<K, V> peekKeyValue(BiConsumer<? super K, ? super V> action) {
return peek(toConsumer(action));
} | java | public EntryStream<K, V> peekKeyValue(BiConsumer<? super K, ? super V> action) {
return peek(toConsumer(action));
} | [
"public",
"EntryStream",
"<",
"K",
",",
"V",
">",
"peekKeyValue",
"(",
"BiConsumer",
"<",
"?",
"super",
"K",
",",
"?",
"super",
"V",
">",
"action",
")",
"{",
"return",
"peek",
"(",
"toConsumer",
"(",
"action",
")",
")",
";",
"}"
] | Returns a stream consisting of the entries of this stream, additionally
performing the provided action on each entry key-value pair as entries
are consumed from the resulting stream.
<p>
This is an <a href="package-summary.html#StreamOps">intermediate</a>
operation.
<p>
For parallel stream pipelines, the action may b... | [
"Returns",
"a",
"stream",
"consisting",
"of",
"the",
"entries",
"of",
"this",
"stream",
"additionally",
"performing",
"the",
"provided",
"action",
"on",
"each",
"entry",
"key",
"-",
"value",
"pair",
"as",
"entries",
"are",
"consumed",
"from",
"the",
"resulting... | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/EntryStream.java#L911-L913 |
117,246 | amaembo/streamex | src/main/java/one/util/streamex/EntryStream.java | EntryStream.collapseKeys | public EntryStream<K, V> collapseKeys(BinaryOperator<V> merger) {
BinaryOperator<Entry<K, V>> entryMerger = (e1, e2) -> new SimpleImmutableEntry<>(e1.getKey(), merger.apply(e1
.getValue(), e2.getValue()));
return new EntryStream<>(new CollapseSpliterator<>(equalKeys(), Function.identi... | java | public EntryStream<K, V> collapseKeys(BinaryOperator<V> merger) {
BinaryOperator<Entry<K, V>> entryMerger = (e1, e2) -> new SimpleImmutableEntry<>(e1.getKey(), merger.apply(e1
.getValue(), e2.getValue()));
return new EntryStream<>(new CollapseSpliterator<>(equalKeys(), Function.identi... | [
"public",
"EntryStream",
"<",
"K",
",",
"V",
">",
"collapseKeys",
"(",
"BinaryOperator",
"<",
"V",
">",
"merger",
")",
"{",
"BinaryOperator",
"<",
"Entry",
"<",
"K",
",",
"V",
">",
">",
"entryMerger",
"=",
"(",
"e1",
",",
"e2",
")",
"->",
"new",
"S... | Merge series of adjacent stream entries with equal keys combining the
corresponding values using the provided function.
<p>
This is a <a href="package-summary.html#StreamOps">quasi-intermediate</a>
partial reduction operation.
<p>
The key of the resulting entry is the key of the first merged entry.
@param merger a n... | [
"Merge",
"series",
"of",
"adjacent",
"stream",
"entries",
"with",
"equal",
"keys",
"combining",
"the",
"corresponding",
"values",
"using",
"the",
"provided",
"function",
"."
] | 936bbd1b7dfbcf64a3b990682bfc848213441d14 | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/EntryStream.java#L1003-L1008 |
117,247 | facebook/SoLoader | java/com/facebook/soloader/DirectorySoSource.java | DirectorySoSource.loadLibraryFrom | protected int loadLibraryFrom(
String soName, int loadFlags, File libDir, StrictMode.ThreadPolicy threadPolicy)
throws IOException {
File soFile = new File(libDir, soName);
if (!soFile.exists()) {
Log.d(SoLoader.TAG, soName + " not found on " + libDir.getCanonicalPath());
return LOAD_RES... | java | protected int loadLibraryFrom(
String soName, int loadFlags, File libDir, StrictMode.ThreadPolicy threadPolicy)
throws IOException {
File soFile = new File(libDir, soName);
if (!soFile.exists()) {
Log.d(SoLoader.TAG, soName + " not found on " + libDir.getCanonicalPath());
return LOAD_RES... | [
"protected",
"int",
"loadLibraryFrom",
"(",
"String",
"soName",
",",
"int",
"loadFlags",
",",
"File",
"libDir",
",",
"StrictMode",
".",
"ThreadPolicy",
"threadPolicy",
")",
"throws",
"IOException",
"{",
"File",
"soFile",
"=",
"new",
"File",
"(",
"libDir",
",",... | Abstracted this logic in another method so subclasses can take advantage of it. | [
"Abstracted",
"this",
"logic",
"in",
"another",
"method",
"so",
"subclasses",
"can",
"take",
"advantage",
"of",
"it",
"."
] | 263af31d2960b2c0d0afe79d80197165a543be86 | https://github.com/facebook/SoLoader/blob/263af31d2960b2c0d0afe79d80197165a543be86/java/com/facebook/soloader/DirectorySoSource.java#L56-L91 |
117,248 | facebook/SoLoader | java/com/facebook/soloader/ApplicationSoSource.java | ApplicationSoSource.checkAndMaybeUpdate | public boolean checkAndMaybeUpdate() throws IOException {
try {
File nativeLibDir = soSource.soDirectory;
Context updatedContext =
applicationContext.createPackageContext(applicationContext.getPackageName(), 0);
File updatedNativeLibDir = new File(updatedContext.getApplicationInfo().nati... | java | public boolean checkAndMaybeUpdate() throws IOException {
try {
File nativeLibDir = soSource.soDirectory;
Context updatedContext =
applicationContext.createPackageContext(applicationContext.getPackageName(), 0);
File updatedNativeLibDir = new File(updatedContext.getApplicationInfo().nati... | [
"public",
"boolean",
"checkAndMaybeUpdate",
"(",
")",
"throws",
"IOException",
"{",
"try",
"{",
"File",
"nativeLibDir",
"=",
"soSource",
".",
"soDirectory",
";",
"Context",
"updatedContext",
"=",
"applicationContext",
".",
"createPackageContext",
"(",
"applicationCont... | check to make sure there haven't been any changes to the nativeLibraryDir since the last check,
if there have been changes, update the context and soSource
@return true if the nativeLibraryDir was updated | [
"check",
"to",
"make",
"sure",
"there",
"haven",
"t",
"been",
"any",
"changes",
"to",
"the",
"nativeLibraryDir",
"since",
"the",
"last",
"check",
"if",
"there",
"have",
"been",
"changes",
"update",
"the",
"context",
"and",
"soSource"
] | 263af31d2960b2c0d0afe79d80197165a543be86 | https://github.com/facebook/SoLoader/blob/263af31d2960b2c0d0afe79d80197165a543be86/java/com/facebook/soloader/ApplicationSoSource.java#L54-L76 |
117,249 | facebook/SoLoader | java/com/facebook/soloader/SoLoader.java | SoLoader.getLibraryPath | public static @Nullable String getLibraryPath(String libName) throws IOException {
sSoSourcesLock.readLock().lock();
String libPath = null;
try {
if (sSoSources != null) {
for (int i = 0; libPath == null && i < sSoSources.length; ++i) {
SoSource currentSource = sSoSources[i];
... | java | public static @Nullable String getLibraryPath(String libName) throws IOException {
sSoSourcesLock.readLock().lock();
String libPath = null;
try {
if (sSoSources != null) {
for (int i = 0; libPath == null && i < sSoSources.length; ++i) {
SoSource currentSource = sSoSources[i];
... | [
"public",
"static",
"@",
"Nullable",
"String",
"getLibraryPath",
"(",
"String",
"libName",
")",
"throws",
"IOException",
"{",
"sSoSourcesLock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"String",
"libPath",
"=",
"null",
";",
"try",
"{",
"if",
... | Gets the full path of a library.
@param libName the library file name, including the prefix and extension.
@return the full path of the library, or null if it is not found in none of the SoSources.
@throws IOException | [
"Gets",
"the",
"full",
"path",
"of",
"a",
"library",
"."
] | 263af31d2960b2c0d0afe79d80197165a543be86 | https://github.com/facebook/SoLoader/blob/263af31d2960b2c0d0afe79d80197165a543be86/java/com/facebook/soloader/SoLoader.java#L490-L504 |
117,250 | facebook/SoLoader | java/com/facebook/soloader/SoLoader.java | SoLoader.loadLibrary | public static boolean loadLibrary(String shortName, int loadFlags) throws UnsatisfiedLinkError {
sSoSourcesLock.readLock().lock();
try {
if (sSoSources == null) {
// This should never happen during normal operation,
// but if we're running in a non-Android environment,
// fall back... | java | public static boolean loadLibrary(String shortName, int loadFlags) throws UnsatisfiedLinkError {
sSoSourcesLock.readLock().lock();
try {
if (sSoSources == null) {
// This should never happen during normal operation,
// but if we're running in a non-Android environment,
// fall back... | [
"public",
"static",
"boolean",
"loadLibrary",
"(",
"String",
"shortName",
",",
"int",
"loadFlags",
")",
"throws",
"UnsatisfiedLinkError",
"{",
"sSoSourcesLock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"sSoSources",
"==",... | Load a shared library, initializing any JNI binding it contains.
@param shortName Name of library to find, without "lib" prefix or ".so" suffix
@param loadFlags Control flags for the loading behavior. See available flags under {@link
SoSource} (LOAD_FLAG_XXX).
@return Whether the library was loaded as a result of this... | [
"Load",
"a",
"shared",
"library",
"initializing",
"any",
"JNI",
"binding",
"it",
"contains",
"."
] | 263af31d2960b2c0d0afe79d80197165a543be86 | https://github.com/facebook/SoLoader/blob/263af31d2960b2c0d0afe79d80197165a543be86/java/com/facebook/soloader/SoLoader.java#L519-L558 |
117,251 | facebook/SoLoader | java/com/facebook/soloader/SoLoader.java | SoLoader.unpackLibraryAndDependencies | public static File unpackLibraryAndDependencies(String shortName) throws UnsatisfiedLinkError {
assertInitialized();
try {
return unpackLibraryBySoName(System.mapLibraryName(shortName));
} catch (IOException ex) {
throw new RuntimeException(ex);
}
} | java | public static File unpackLibraryAndDependencies(String shortName) throws UnsatisfiedLinkError {
assertInitialized();
try {
return unpackLibraryBySoName(System.mapLibraryName(shortName));
} catch (IOException ex) {
throw new RuntimeException(ex);
}
} | [
"public",
"static",
"File",
"unpackLibraryAndDependencies",
"(",
"String",
"shortName",
")",
"throws",
"UnsatisfiedLinkError",
"{",
"assertInitialized",
"(",
")",
";",
"try",
"{",
"return",
"unpackLibraryBySoName",
"(",
"System",
".",
"mapLibraryName",
"(",
"shortName... | Unpack library and its dependencies, returning the location of the unpacked library file. All
non-system dependencies of the given library will either be on LD_LIBRARY_PATH or will be in
the same directory as the returned File.
@param shortName Name of library to find, without "lib" prefix or ".so" suffix
@return Unpa... | [
"Unpack",
"library",
"and",
"its",
"dependencies",
"returning",
"the",
"location",
"of",
"the",
"unpacked",
"library",
"file",
".",
"All",
"non",
"-",
"system",
"dependencies",
"of",
"the",
"given",
"library",
"will",
"either",
"be",
"on",
"LD_LIBRARY_PATH",
"... | 263af31d2960b2c0d0afe79d80197165a543be86 | https://github.com/facebook/SoLoader/blob/263af31d2960b2c0d0afe79d80197165a543be86/java/com/facebook/soloader/SoLoader.java#L659-L666 |
117,252 | facebook/SoLoader | java/com/facebook/soloader/SoLoader.java | SoLoader.prependSoSource | public static void prependSoSource(SoSource extraSoSource) throws IOException {
sSoSourcesLock.writeLock().lock();
try {
Log.d(TAG, "Prepending to SO sources: " + extraSoSource);
assertInitialized();
extraSoSource.prepare(makePrepareFlags());
SoSource[] newSoSources = new SoSource[sSoSou... | java | public static void prependSoSource(SoSource extraSoSource) throws IOException {
sSoSourcesLock.writeLock().lock();
try {
Log.d(TAG, "Prepending to SO sources: " + extraSoSource);
assertInitialized();
extraSoSource.prepare(makePrepareFlags());
SoSource[] newSoSources = new SoSource[sSoSou... | [
"public",
"static",
"void",
"prependSoSource",
"(",
"SoSource",
"extraSoSource",
")",
"throws",
"IOException",
"{",
"sSoSourcesLock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"Log",
".",
"d",
"(",
"TAG",
",",
"\"Prepending to SO so... | Add a new source of native libraries. SoLoader consults the new source before any
currently-installed source.
@param extraSoSource The SoSource to install | [
"Add",
"a",
"new",
"source",
"of",
"native",
"libraries",
".",
"SoLoader",
"consults",
"the",
"new",
"source",
"before",
"any",
"currently",
"-",
"installed",
"source",
"."
] | 263af31d2960b2c0d0afe79d80197165a543be86 | https://github.com/facebook/SoLoader/blob/263af31d2960b2c0d0afe79d80197165a543be86/java/com/facebook/soloader/SoLoader.java#L817-L832 |
117,253 | facebook/SoLoader | java/com/facebook/soloader/SoLoader.java | SoLoader.makeLdLibraryPath | public static String makeLdLibraryPath() {
sSoSourcesLock.readLock().lock();
try {
assertInitialized();
Log.d(TAG, "makeLdLibraryPath");
ArrayList<String> pathElements = new ArrayList<>();
SoSource[] soSources = sSoSources;
for (int i = 0; i < soSources.length; ++i) {
soSou... | java | public static String makeLdLibraryPath() {
sSoSourcesLock.readLock().lock();
try {
assertInitialized();
Log.d(TAG, "makeLdLibraryPath");
ArrayList<String> pathElements = new ArrayList<>();
SoSource[] soSources = sSoSources;
for (int i = 0; i < soSources.length; ++i) {
soSou... | [
"public",
"static",
"String",
"makeLdLibraryPath",
"(",
")",
"{",
"sSoSourcesLock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"assertInitialized",
"(",
")",
";",
"Log",
".",
"d",
"(",
"TAG",
",",
"\"makeLdLibraryPath\"",
")",
";"... | Retrieve an LD_LIBRARY_PATH value suitable for using the native linker to resolve our shared
libraries. | [
"Retrieve",
"an",
"LD_LIBRARY_PATH",
"value",
"suitable",
"for",
"using",
"the",
"native",
"linker",
"to",
"resolve",
"our",
"shared",
"libraries",
"."
] | 263af31d2960b2c0d0afe79d80197165a543be86 | https://github.com/facebook/SoLoader/blob/263af31d2960b2c0d0afe79d80197165a543be86/java/com/facebook/soloader/SoLoader.java#L838-L854 |
117,254 | facebook/SoLoader | java/com/facebook/soloader/SoLoader.java | SoLoader.areSoSourcesAbisSupported | public static boolean areSoSourcesAbisSupported() {
sSoSourcesLock.readLock().lock();
try {
if (sSoSources == null) {
return false;
}
String supportedAbis[] = SysUtil.getSupportedAbis();
for (int i = 0; i < sSoSources.length; ++i) {
String[] soSourceAbis = sSoSources[i].... | java | public static boolean areSoSourcesAbisSupported() {
sSoSourcesLock.readLock().lock();
try {
if (sSoSources == null) {
return false;
}
String supportedAbis[] = SysUtil.getSupportedAbis();
for (int i = 0; i < sSoSources.length; ++i) {
String[] soSourceAbis = sSoSources[i].... | [
"public",
"static",
"boolean",
"areSoSourcesAbisSupported",
"(",
")",
"{",
"sSoSourcesLock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"sSoSources",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"String",
"suppo... | This function ensure that every SoSources Abi is supported for at least one abi in
SysUtil.getSupportedAbis
@return true if all SoSources have their Abis supported | [
"This",
"function",
"ensure",
"that",
"every",
"SoSources",
"Abi",
"is",
"supported",
"for",
"at",
"least",
"one",
"abi",
"in",
"SysUtil",
".",
"getSupportedAbis"
] | 263af31d2960b2c0d0afe79d80197165a543be86 | https://github.com/facebook/SoLoader/blob/263af31d2960b2c0d0afe79d80197165a543be86/java/com/facebook/soloader/SoLoader.java#L862-L888 |
117,255 | facebook/SoLoader | java/com/facebook/soloader/NativeLibrary.java | NativeLibrary.loadLibraries | @Nullable
public boolean loadLibraries() {
synchronized (mLock) {
if (mLoadLibraries == false) {
return mLibrariesLoaded;
}
try {
if (mLibraryNames != null) {
for (String name : mLibraryNames) {
SoLoader.loadLibrary(name);
}
}
initi... | java | @Nullable
public boolean loadLibraries() {
synchronized (mLock) {
if (mLoadLibraries == false) {
return mLibrariesLoaded;
}
try {
if (mLibraryNames != null) {
for (String name : mLibraryNames) {
SoLoader.loadLibrary(name);
}
}
initi... | [
"@",
"Nullable",
"public",
"boolean",
"loadLibraries",
"(",
")",
"{",
"synchronized",
"(",
"mLock",
")",
"{",
"if",
"(",
"mLoadLibraries",
"==",
"false",
")",
"{",
"return",
"mLibrariesLoaded",
";",
"}",
"try",
"{",
"if",
"(",
"mLibraryNames",
"!=",
"null"... | safe loading of native libs
@return true if native libs loaded properly, false otherwise | [
"safe",
"loading",
"of",
"native",
"libs"
] | 263af31d2960b2c0d0afe79d80197165a543be86 | https://github.com/facebook/SoLoader/blob/263af31d2960b2c0d0afe79d80197165a543be86/java/com/facebook/soloader/NativeLibrary.java#L53-L81 |
117,256 | facebook/SoLoader | java/com/facebook/soloader/SysUtil.java | SysUtil.findAbiScore | public static int findAbiScore(String[] supportedAbis, String abi) {
for (int i = 0; i < supportedAbis.length; ++i) {
if (supportedAbis[i] != null && abi.equals(supportedAbis[i])) {
return i;
}
}
return -1;
} | java | public static int findAbiScore(String[] supportedAbis, String abi) {
for (int i = 0; i < supportedAbis.length; ++i) {
if (supportedAbis[i] != null && abi.equals(supportedAbis[i])) {
return i;
}
}
return -1;
} | [
"public",
"static",
"int",
"findAbiScore",
"(",
"String",
"[",
"]",
"supportedAbis",
",",
"String",
"abi",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"supportedAbis",
".",
"length",
";",
"++",
"i",
")",
"{",
"if",
"(",
"supportedAbis"... | Determine how preferred a given ABI is on this system.
@param supportedAbis ABIs on this system
@param abi ABI of a shared library we might want to unpack
@return -1 if not supported or an integer, smaller being more preferred | [
"Determine",
"how",
"preferred",
"a",
"given",
"ABI",
"is",
"on",
"this",
"system",
"."
] | 263af31d2960b2c0d0afe79d80197165a543be86 | https://github.com/facebook/SoLoader/blob/263af31d2960b2c0d0afe79d80197165a543be86/java/com/facebook/soloader/SysUtil.java#L45-L53 |
117,257 | facebook/SoLoader | java/com/facebook/soloader/SysUtil.java | SysUtil.getSupportedAbis | public static String[] getSupportedAbis() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
return new String[]{Build.CPU_ABI, Build.CPU_ABI2};
} else {
return LollipopSysdeps.getSupportedAbis();
}
} | java | public static String[] getSupportedAbis() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
return new String[]{Build.CPU_ABI, Build.CPU_ABI2};
} else {
return LollipopSysdeps.getSupportedAbis();
}
} | [
"public",
"static",
"String",
"[",
"]",
"getSupportedAbis",
"(",
")",
"{",
"if",
"(",
"Build",
".",
"VERSION",
".",
"SDK_INT",
"<",
"Build",
".",
"VERSION_CODES",
".",
"LOLLIPOP",
")",
"{",
"return",
"new",
"String",
"[",
"]",
"{",
"Build",
".",
"CPU_A... | Return an list of ABIs we supported on this device ordered according to preference. Use a
separate inner class to isolate the version-dependent call where it won't cause the whole
class to fail preverification.
@return Ordered array of supported ABIs | [
"Return",
"an",
"list",
"of",
"ABIs",
"we",
"supported",
"on",
"this",
"device",
"ordered",
"according",
"to",
"preference",
".",
"Use",
"a",
"separate",
"inner",
"class",
"to",
"isolate",
"the",
"version",
"-",
"dependent",
"call",
"where",
"it",
"won",
"... | 263af31d2960b2c0d0afe79d80197165a543be86 | https://github.com/facebook/SoLoader/blob/263af31d2960b2c0d0afe79d80197165a543be86/java/com/facebook/soloader/SysUtil.java#L68-L74 |
117,258 | facebook/SoLoader | java/com/facebook/soloader/SysUtil.java | SysUtil.fallocateIfSupported | public static void fallocateIfSupported(FileDescriptor fd, long length) throws IOException {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
LollipopSysdeps.fallocateIfSupported(fd, length);
}
} | java | public static void fallocateIfSupported(FileDescriptor fd, long length) throws IOException {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
LollipopSysdeps.fallocateIfSupported(fd, length);
}
} | [
"public",
"static",
"void",
"fallocateIfSupported",
"(",
"FileDescriptor",
"fd",
",",
"long",
"length",
")",
"throws",
"IOException",
"{",
"if",
"(",
"Build",
".",
"VERSION",
".",
"SDK_INT",
">=",
"Build",
".",
"VERSION_CODES",
".",
"LOLLIPOP",
")",
"{",
"Lo... | Pre-allocate disk space for a file if we can do that
on this version of the OS.
@param fd File descriptor for file
@param length Number of bytes to allocate. | [
"Pre",
"-",
"allocate",
"disk",
"space",
"for",
"a",
"file",
"if",
"we",
"can",
"do",
"that",
"on",
"this",
"version",
"of",
"the",
"OS",
"."
] | 263af31d2960b2c0d0afe79d80197165a543be86 | https://github.com/facebook/SoLoader/blob/263af31d2960b2c0d0afe79d80197165a543be86/java/com/facebook/soloader/SysUtil.java#L83-L87 |
117,259 | facebook/SoLoader | java/com/facebook/soloader/SysUtil.java | SysUtil.dumbDeleteRecursive | public static void dumbDeleteRecursive(File file) throws IOException {
if (file.isDirectory()) {
File[] fileList = file.listFiles();
if (fileList == null) {
// If file is not a directory, listFiles() will return null
return;
}
for (File entry : fileList) {
dumbDeleteR... | java | public static void dumbDeleteRecursive(File file) throws IOException {
if (file.isDirectory()) {
File[] fileList = file.listFiles();
if (fileList == null) {
// If file is not a directory, listFiles() will return null
return;
}
for (File entry : fileList) {
dumbDeleteR... | [
"public",
"static",
"void",
"dumbDeleteRecursive",
"(",
"File",
"file",
")",
"throws",
"IOException",
"{",
"if",
"(",
"file",
".",
"isDirectory",
"(",
")",
")",
"{",
"File",
"[",
"]",
"fileList",
"=",
"file",
".",
"listFiles",
"(",
")",
";",
"if",
"(",... | Delete a directory and its contents.
WARNING: Java APIs do not let us distinguish directories from symbolic links to directories.
Consequently, if the directory contains symbolic links to directories, we will attempt to
delete the contents of pointed-to directories.
@param file File or directory to delete | [
"Delete",
"a",
"directory",
"and",
"its",
"contents",
"."
] | 263af31d2960b2c0d0afe79d80197165a543be86 | https://github.com/facebook/SoLoader/blob/263af31d2960b2c0d0afe79d80197165a543be86/java/com/facebook/soloader/SysUtil.java#L98-L113 |
117,260 | facebook/SoLoader | java/com/facebook/soloader/SysUtil.java | SysUtil.mkdirOrThrow | static void mkdirOrThrow(File dir) throws IOException {
if (!dir.mkdirs() && !dir.isDirectory()) {
throw new IOException("cannot mkdir: " + dir);
}
} | java | static void mkdirOrThrow(File dir) throws IOException {
if (!dir.mkdirs() && !dir.isDirectory()) {
throw new IOException("cannot mkdir: " + dir);
}
} | [
"static",
"void",
"mkdirOrThrow",
"(",
"File",
"dir",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"dir",
".",
"mkdirs",
"(",
")",
"&&",
"!",
"dir",
".",
"isDirectory",
"(",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"cannot mkdir: \"",
... | Like File.mkdirs, but throws on error. Succeeds even if
File.mkdirs "fails", but dir still names a directory.
@param dir Directory to create. All parents created as well. | [
"Like",
"File",
".",
"mkdirs",
"but",
"throws",
"on",
"error",
".",
"Succeeds",
"even",
"if",
"File",
".",
"mkdirs",
"fails",
"but",
"dir",
"still",
"names",
"a",
"directory",
"."
] | 263af31d2960b2c0d0afe79d80197165a543be86 | https://github.com/facebook/SoLoader/blob/263af31d2960b2c0d0afe79d80197165a543be86/java/com/facebook/soloader/SysUtil.java#L147-L151 |
117,261 | facebook/SoLoader | java/com/facebook/soloader/SysUtil.java | SysUtil.copyBytes | static int copyBytes(RandomAccessFile os, InputStream is, int byteLimit, byte[] buffer)
throws IOException {
// Yes, this method is exactly the same as the above, just with a different type for `os'.
int bytesCopied = 0;
int nrRead;
while (bytesCopied < byteLimit &&
(nrRead = is.read(
... | java | static int copyBytes(RandomAccessFile os, InputStream is, int byteLimit, byte[] buffer)
throws IOException {
// Yes, this method is exactly the same as the above, just with a different type for `os'.
int bytesCopied = 0;
int nrRead;
while (bytesCopied < byteLimit &&
(nrRead = is.read(
... | [
"static",
"int",
"copyBytes",
"(",
"RandomAccessFile",
"os",
",",
"InputStream",
"is",
",",
"int",
"byteLimit",
",",
"byte",
"[",
"]",
"buffer",
")",
"throws",
"IOException",
"{",
"// Yes, this method is exactly the same as the above, just with a different type for `os'.",
... | Copy up to byteLimit bytes from the input stream to the output stream.
@param os Destination stream
@param is Input stream
@param byteLimit Maximum number of bytes to copy
@param buffer IO buffer to use
@return Number of bytes actually copied | [
"Copy",
"up",
"to",
"byteLimit",
"bytes",
"from",
"the",
"input",
"stream",
"to",
"the",
"output",
"stream",
"."
] | 263af31d2960b2c0d0afe79d80197165a543be86 | https://github.com/facebook/SoLoader/blob/263af31d2960b2c0d0afe79d80197165a543be86/java/com/facebook/soloader/SysUtil.java#L162-L176 |
117,262 | facebook/SoLoader | java/com/facebook/soloader/UnpackingSoSource.java | UnpackingSoSource.deleteUnmentionedFiles | private void deleteUnmentionedFiles(Dso[] dsos) throws IOException {
String[] existingFiles = soDirectory.list();
if (existingFiles == null) {
throw new IOException("unable to list directory " + soDirectory);
}
for (int i = 0; i < existingFiles.length; ++i) {
String fileName = existingFiles... | java | private void deleteUnmentionedFiles(Dso[] dsos) throws IOException {
String[] existingFiles = soDirectory.list();
if (existingFiles == null) {
throw new IOException("unable to list directory " + soDirectory);
}
for (int i = 0; i < existingFiles.length; ++i) {
String fileName = existingFiles... | [
"private",
"void",
"deleteUnmentionedFiles",
"(",
"Dso",
"[",
"]",
"dsos",
")",
"throws",
"IOException",
"{",
"String",
"[",
"]",
"existingFiles",
"=",
"soDirectory",
".",
"list",
"(",
")",
";",
"if",
"(",
"existingFiles",
"==",
"null",
")",
"{",
"throw",
... | Delete files not mentioned in the given DSO list. | [
"Delete",
"files",
"not",
"mentioned",
"in",
"the",
"given",
"DSO",
"list",
"."
] | 263af31d2960b2c0d0afe79d80197165a543be86 | https://github.com/facebook/SoLoader/blob/263af31d2960b2c0d0afe79d80197165a543be86/java/com/facebook/soloader/UnpackingSoSource.java#L183-L211 |
117,263 | facebook/SoLoader | java/com/facebook/soloader/UnpackingSoSource.java | UnpackingSoSource.prepare | @Override
protected void prepare(int flags) throws IOException {
SysUtil.mkdirOrThrow(soDirectory);
File lockFileName = new File(soDirectory, LOCK_FILE_NAME);
FileLocker lock = FileLocker.lock(lockFileName);
try {
Log.v(TAG, "locked dso store " + soDirectory);
if (refreshLocked(lock, flags... | java | @Override
protected void prepare(int flags) throws IOException {
SysUtil.mkdirOrThrow(soDirectory);
File lockFileName = new File(soDirectory, LOCK_FILE_NAME);
FileLocker lock = FileLocker.lock(lockFileName);
try {
Log.v(TAG, "locked dso store " + soDirectory);
if (refreshLocked(lock, flags... | [
"@",
"Override",
"protected",
"void",
"prepare",
"(",
"int",
"flags",
")",
"throws",
"IOException",
"{",
"SysUtil",
".",
"mkdirOrThrow",
"(",
"soDirectory",
")",
";",
"File",
"lockFileName",
"=",
"new",
"File",
"(",
"soDirectory",
",",
"LOCK_FILE_NAME",
")",
... | Verify or refresh the state of the shared library store. | [
"Verify",
"or",
"refresh",
"the",
"state",
"of",
"the",
"shared",
"library",
"store",
"."
] | 263af31d2960b2c0d0afe79d80197165a543be86 | https://github.com/facebook/SoLoader/blob/263af31d2960b2c0d0afe79d80197165a543be86/java/com/facebook/soloader/UnpackingSoSource.java#L413-L434 |
117,264 | facebook/SoLoader | java/com/facebook/soloader/UnpackingSoSource.java | UnpackingSoSource.prepare | protected synchronized void prepare(String soName) throws IOException {
// Only one thread at a time can try to recover a corrupted lib from the same source
Object lock = getLibraryLock(soName);
synchronized (lock) {
// While recovering, do not allow loading the same lib from another thread
mCor... | java | protected synchronized void prepare(String soName) throws IOException {
// Only one thread at a time can try to recover a corrupted lib from the same source
Object lock = getLibraryLock(soName);
synchronized (lock) {
// While recovering, do not allow loading the same lib from another thread
mCor... | [
"protected",
"synchronized",
"void",
"prepare",
"(",
"String",
"soName",
")",
"throws",
"IOException",
"{",
"// Only one thread at a time can try to recover a corrupted lib from the same source",
"Object",
"lock",
"=",
"getLibraryLock",
"(",
"soName",
")",
";",
"synchronized"... | Prepare this SoSource extracting a corrupted library. | [
"Prepare",
"this",
"SoSource",
"extracting",
"a",
"corrupted",
"library",
"."
] | 263af31d2960b2c0d0afe79d80197165a543be86 | https://github.com/facebook/SoLoader/blob/263af31d2960b2c0d0afe79d80197165a543be86/java/com/facebook/soloader/UnpackingSoSource.java#L448-L456 |
117,265 | opentracing-contrib/java-kafka-client | opentracing-kafka-client/src/main/java/io/opentracing/contrib/kafka/SpanDecorator.java | SpanDecorator.onSend | static <K, V> void onSend(ProducerRecord<K, V> record, Span span) {
setCommonTags(span);
Tags.MESSAGE_BUS_DESTINATION.set(span, record.topic());
if (record.partition() != null) {
span.setTag("partition", record.partition());
}
} | java | static <K, V> void onSend(ProducerRecord<K, V> record, Span span) {
setCommonTags(span);
Tags.MESSAGE_BUS_DESTINATION.set(span, record.topic());
if (record.partition() != null) {
span.setTag("partition", record.partition());
}
} | [
"static",
"<",
"K",
",",
"V",
">",
"void",
"onSend",
"(",
"ProducerRecord",
"<",
"K",
",",
"V",
">",
"record",
",",
"Span",
"span",
")",
"{",
"setCommonTags",
"(",
"span",
")",
";",
"Tags",
".",
"MESSAGE_BUS_DESTINATION",
".",
"set",
"(",
"span",
","... | Called before record is sent by producer | [
"Called",
"before",
"record",
"is",
"sent",
"by",
"producer"
] | e3aeec8d68d3a2dead89b9dbdfea3791817e1a26 | https://github.com/opentracing-contrib/java-kafka-client/blob/e3aeec8d68d3a2dead89b9dbdfea3791817e1a26/opentracing-kafka-client/src/main/java/io/opentracing/contrib/kafka/SpanDecorator.java#L34-L40 |
117,266 | opentracing-contrib/java-kafka-client | opentracing-kafka-client/src/main/java/io/opentracing/contrib/kafka/SpanDecorator.java | SpanDecorator.onResponse | static <K, V> void onResponse(ConsumerRecord<K, V> record, Span span) {
setCommonTags(span);
span.setTag("partition", record.partition());
span.setTag("topic", record.topic());
span.setTag("offset", record.offset());
} | java | static <K, V> void onResponse(ConsumerRecord<K, V> record, Span span) {
setCommonTags(span);
span.setTag("partition", record.partition());
span.setTag("topic", record.topic());
span.setTag("offset", record.offset());
} | [
"static",
"<",
"K",
",",
"V",
">",
"void",
"onResponse",
"(",
"ConsumerRecord",
"<",
"K",
",",
"V",
">",
"record",
",",
"Span",
"span",
")",
"{",
"setCommonTags",
"(",
"span",
")",
";",
"span",
".",
"setTag",
"(",
"\"partition\"",
",",
"record",
".",... | Called when record is received in consumer | [
"Called",
"when",
"record",
"is",
"received",
"in",
"consumer"
] | e3aeec8d68d3a2dead89b9dbdfea3791817e1a26 | https://github.com/opentracing-contrib/java-kafka-client/blob/e3aeec8d68d3a2dead89b9dbdfea3791817e1a26/opentracing-kafka-client/src/main/java/io/opentracing/contrib/kafka/SpanDecorator.java#L45-L51 |
117,267 | opentracing-contrib/java-kafka-client | opentracing-kafka-client/src/main/java/io/opentracing/contrib/kafka/TracingKafkaUtils.java | TracingKafkaUtils.extract | static SpanContext extract(Headers headers, Tracer tracer) {
return tracer
.extract(Format.Builtin.TEXT_MAP, new HeadersMapExtractAdapter(headers, false));
} | java | static SpanContext extract(Headers headers, Tracer tracer) {
return tracer
.extract(Format.Builtin.TEXT_MAP, new HeadersMapExtractAdapter(headers, false));
} | [
"static",
"SpanContext",
"extract",
"(",
"Headers",
"headers",
",",
"Tracer",
"tracer",
")",
"{",
"return",
"tracer",
".",
"extract",
"(",
"Format",
".",
"Builtin",
".",
"TEXT_MAP",
",",
"new",
"HeadersMapExtractAdapter",
"(",
"headers",
",",
"false",
")",
"... | Extract Span Context from record headers
@param headers record headers
@return span context | [
"Extract",
"Span",
"Context",
"from",
"record",
"headers"
] | e3aeec8d68d3a2dead89b9dbdfea3791817e1a26 | https://github.com/opentracing-contrib/java-kafka-client/blob/e3aeec8d68d3a2dead89b9dbdfea3791817e1a26/opentracing-kafka-client/src/main/java/io/opentracing/contrib/kafka/TracingKafkaUtils.java#L41-L44 |
117,268 | opentracing-contrib/java-kafka-client | opentracing-kafka-client/src/main/java/io/opentracing/contrib/kafka/TracingKafkaUtils.java | TracingKafkaUtils.extractSpanContext | public static SpanContext extractSpanContext(Headers headers, Tracer tracer) {
return tracer
.extract(Format.Builtin.TEXT_MAP, new HeadersMapExtractAdapter(headers, true));
} | java | public static SpanContext extractSpanContext(Headers headers, Tracer tracer) {
return tracer
.extract(Format.Builtin.TEXT_MAP, new HeadersMapExtractAdapter(headers, true));
} | [
"public",
"static",
"SpanContext",
"extractSpanContext",
"(",
"Headers",
"headers",
",",
"Tracer",
"tracer",
")",
"{",
"return",
"tracer",
".",
"extract",
"(",
"Format",
".",
"Builtin",
".",
"TEXT_MAP",
",",
"new",
"HeadersMapExtractAdapter",
"(",
"headers",
","... | Extract Span Context from Consumer record headers
@param headers Consumer record headers
@return span context | [
"Extract",
"Span",
"Context",
"from",
"Consumer",
"record",
"headers"
] | e3aeec8d68d3a2dead89b9dbdfea3791817e1a26 | https://github.com/opentracing-contrib/java-kafka-client/blob/e3aeec8d68d3a2dead89b9dbdfea3791817e1a26/opentracing-kafka-client/src/main/java/io/opentracing/contrib/kafka/TracingKafkaUtils.java#L52-L55 |
117,269 | opentracing-contrib/java-kafka-client | opentracing-kafka-client/src/main/java/io/opentracing/contrib/kafka/TracingKafkaUtils.java | TracingKafkaUtils.inject | static void inject(SpanContext spanContext, Headers headers,
Tracer tracer) {
tracer.inject(spanContext, Format.Builtin.TEXT_MAP,
new HeadersMapInjectAdapter(headers, false));
} | java | static void inject(SpanContext spanContext, Headers headers,
Tracer tracer) {
tracer.inject(spanContext, Format.Builtin.TEXT_MAP,
new HeadersMapInjectAdapter(headers, false));
} | [
"static",
"void",
"inject",
"(",
"SpanContext",
"spanContext",
",",
"Headers",
"headers",
",",
"Tracer",
"tracer",
")",
"{",
"tracer",
".",
"inject",
"(",
"spanContext",
",",
"Format",
".",
"Builtin",
".",
"TEXT_MAP",
",",
"new",
"HeadersMapInjectAdapter",
"("... | Inject Span Context to record headers
@param spanContext Span Context
@param headers record headers | [
"Inject",
"Span",
"Context",
"to",
"record",
"headers"
] | e3aeec8d68d3a2dead89b9dbdfea3791817e1a26 | https://github.com/opentracing-contrib/java-kafka-client/blob/e3aeec8d68d3a2dead89b9dbdfea3791817e1a26/opentracing-kafka-client/src/main/java/io/opentracing/contrib/kafka/TracingKafkaUtils.java#L63-L67 |
117,270 | opentracing-contrib/java-kafka-client | opentracing-kafka-client/src/main/java/io/opentracing/contrib/kafka/TracingKafkaUtils.java | TracingKafkaUtils.injectSecond | static void injectSecond(SpanContext spanContext, Headers headers,
Tracer tracer) {
tracer.inject(spanContext, Format.Builtin.TEXT_MAP,
new HeadersMapInjectAdapter(headers, true));
} | java | static void injectSecond(SpanContext spanContext, Headers headers,
Tracer tracer) {
tracer.inject(spanContext, Format.Builtin.TEXT_MAP,
new HeadersMapInjectAdapter(headers, true));
} | [
"static",
"void",
"injectSecond",
"(",
"SpanContext",
"spanContext",
",",
"Headers",
"headers",
",",
"Tracer",
"tracer",
")",
"{",
"tracer",
".",
"inject",
"(",
"spanContext",
",",
"Format",
".",
"Builtin",
".",
"TEXT_MAP",
",",
"new",
"HeadersMapInjectAdapter",... | Inject second Span Context to record headers
@param spanContext Span Context
@param headers record headers | [
"Inject",
"second",
"Span",
"Context",
"to",
"record",
"headers"
] | e3aeec8d68d3a2dead89b9dbdfea3791817e1a26 | https://github.com/opentracing-contrib/java-kafka-client/blob/e3aeec8d68d3a2dead89b9dbdfea3791817e1a26/opentracing-kafka-client/src/main/java/io/opentracing/contrib/kafka/TracingKafkaUtils.java#L75-L79 |
117,271 | sirthias/pegdown | src/main/java/org/pegdown/Parser.java | Parser.BlockQuote | public Rule BlockQuote() {
StringBuilderVar inner = new StringBuilderVar();
StringBuilderVar optional = new StringBuilderVar();
return NodeSequence(
OneOrMore(
CrossedOut(Sequence('>', Optional(' ')), inner), Line(inner),
ZeroOrMore... | java | public Rule BlockQuote() {
StringBuilderVar inner = new StringBuilderVar();
StringBuilderVar optional = new StringBuilderVar();
return NodeSequence(
OneOrMore(
CrossedOut(Sequence('>', Optional(' ')), inner), Line(inner),
ZeroOrMore... | [
"public",
"Rule",
"BlockQuote",
"(",
")",
"{",
"StringBuilderVar",
"inner",
"=",
"new",
"StringBuilderVar",
"(",
")",
";",
"StringBuilderVar",
"optional",
"=",
"new",
"StringBuilderVar",
"(",
")",
";",
"return",
"NodeSequence",
"(",
"OneOrMore",
"(",
"CrossedOut... | otherwise don't include the blank lines, they are not part of the block quote | [
"otherwise",
"don",
"t",
"include",
"the",
"blank",
"lines",
"they",
"are",
"not",
"part",
"of",
"the",
"block",
"quote"
] | 19ca3d3d2bea5df19eb885260ab24f1200a16452 | https://github.com/sirthias/pegdown/blob/19ca3d3d2bea5df19eb885260ab24f1200a16452/src/main/java/org/pegdown/Parser.java#L142-L166 |
117,272 | sirthias/pegdown | src/main/java/org/pegdown/Parser.java | Parser.mayEnterEmphOrStrong | protected boolean mayEnterEmphOrStrong(String chars){
if( !isLegalEmphOrStrongStartPos() ){
return false;
}
Object parent = peek(2);
boolean isStrong = ( chars.length()==2 );
if( StrongEmphSuperNode.class.equals( parent.getClass() ) ){
if( (... | java | protected boolean mayEnterEmphOrStrong(String chars){
if( !isLegalEmphOrStrongStartPos() ){
return false;
}
Object parent = peek(2);
boolean isStrong = ( chars.length()==2 );
if( StrongEmphSuperNode.class.equals( parent.getClass() ) ){
if( (... | [
"protected",
"boolean",
"mayEnterEmphOrStrong",
"(",
"String",
"chars",
")",
"{",
"if",
"(",
"!",
"isLegalEmphOrStrongStartPos",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"Object",
"parent",
"=",
"peek",
"(",
"2",
")",
";",
"boolean",
"isStrong",
"=... | This method checks if the parser can enter an emph or strong sequence
Emph only allows Strong as direct child, Strong only allows Emph as
direct child. | [
"This",
"method",
"checks",
"if",
"the",
"parser",
"can",
"enter",
"an",
"emph",
"or",
"strong",
"sequence",
"Emph",
"only",
"allows",
"Strong",
"as",
"direct",
"child",
"Strong",
"only",
"allows",
"Emph",
"as",
"direct",
"child",
"."
] | 19ca3d3d2bea5df19eb885260ab24f1200a16452 | https://github.com/sirthias/pegdown/blob/19ca3d3d2bea5df19eb885260ab24f1200a16452/src/main/java/org/pegdown/Parser.java#L988-L1001 |
117,273 | sirthias/pegdown | src/main/java/org/pegdown/Parser.java | Parser.isLegalEmphOrStrongClosePos | protected boolean isLegalEmphOrStrongClosePos(){
Object lastItem = peek();
if ( StrongEmphSuperNode.class.equals( lastItem.getClass() ) ){
List<Node> children = ((StrongEmphSuperNode) lastItem).getChildren();
if(children.size() < 1)
return true;
... | java | protected boolean isLegalEmphOrStrongClosePos(){
Object lastItem = peek();
if ( StrongEmphSuperNode.class.equals( lastItem.getClass() ) ){
List<Node> children = ((StrongEmphSuperNode) lastItem).getChildren();
if(children.size() < 1)
return true;
... | [
"protected",
"boolean",
"isLegalEmphOrStrongClosePos",
"(",
")",
"{",
"Object",
"lastItem",
"=",
"peek",
"(",
")",
";",
"if",
"(",
"StrongEmphSuperNode",
".",
"class",
".",
"equals",
"(",
"lastItem",
".",
"getClass",
"(",
")",
")",
")",
"{",
"List",
"<",
... | This method checks if the last parsed character or sequence is a valid prefix for a closing char for
an emph or strong sequence. | [
"This",
"method",
"checks",
"if",
"the",
"last",
"parsed",
"character",
"or",
"sequence",
"is",
"a",
"valid",
"prefix",
"for",
"a",
"closing",
"char",
"for",
"an",
"emph",
"or",
"strong",
"sequence",
"."
] | 19ca3d3d2bea5df19eb885260ab24f1200a16452 | https://github.com/sirthias/pegdown/blob/19ca3d3d2bea5df19eb885260ab24f1200a16452/src/main/java/org/pegdown/Parser.java#L1083-L1102 |
117,274 | sirthias/pegdown | src/main/java/org/pegdown/Parser.java | Parser.ImageAlt | public Rule ImageAlt(){
return Sequence(
'[',
checkForParsingTimeout(),
push(new SuperNode()),
ZeroOrMore(TestNot(']'), NonAutoLinkInline(), addAsChild()),
']'
);
} | java | public Rule ImageAlt(){
return Sequence(
'[',
checkForParsingTimeout(),
push(new SuperNode()),
ZeroOrMore(TestNot(']'), NonAutoLinkInline(), addAsChild()),
']'
);
} | [
"public",
"Rule",
"ImageAlt",
"(",
")",
"{",
"return",
"Sequence",
"(",
"'",
"'",
",",
"checkForParsingTimeout",
"(",
")",
",",
"push",
"(",
"new",
"SuperNode",
"(",
")",
")",
",",
"ZeroOrMore",
"(",
"TestNot",
"(",
"'",
"'",
")",
",",
"NonAutoLinkInli... | can't treat labels the same as the image alt since the image alt should be able to empty. | [
"can",
"t",
"treat",
"labels",
"the",
"same",
"as",
"the",
"image",
"alt",
"since",
"the",
"image",
"alt",
"should",
"be",
"able",
"to",
"empty",
"."
] | 19ca3d3d2bea5df19eb885260ab24f1200a16452 | https://github.com/sirthias/pegdown/blob/19ca3d3d2bea5df19eb885260ab24f1200a16452/src/main/java/org/pegdown/Parser.java#L1244-L1252 |
117,275 | sirthias/pegdown | src/main/java/org/pegdown/Parser.java | Parser.TableCell | public Rule TableCell() {
return Sequence(
NodeSequence(
push(new TableCellNode()),
TestNot(Sp(), Optional(':'), Sp(), OneOrMore('-'), Sp(), Optional(':'), Sp(), FirstOf('|', Newline())),
Optional(Sp(), TestNot('|'), NotNewl... | java | public Rule TableCell() {
return Sequence(
NodeSequence(
push(new TableCellNode()),
TestNot(Sp(), Optional(':'), Sp(), OneOrMore('-'), Sp(), Optional(':'), Sp(), FirstOf('|', Newline())),
Optional(Sp(), TestNot('|'), NotNewl... | [
"public",
"Rule",
"TableCell",
"(",
")",
"{",
"return",
"Sequence",
"(",
"NodeSequence",
"(",
"push",
"(",
"new",
"TableCellNode",
"(",
")",
")",
",",
"TestNot",
"(",
"Sp",
"(",
")",
",",
"Optional",
"(",
"'",
"'",
")",
",",
"Sp",
"(",
")",
",",
... | that the TableCell will include only the text of the cell. | [
"that",
"the",
"TableCell",
"will",
"include",
"only",
"the",
"text",
"of",
"the",
"cell",
"."
] | 19ca3d3d2bea5df19eb885260ab24f1200a16452 | https://github.com/sirthias/pegdown/blob/19ca3d3d2bea5df19eb885260ab24f1200a16452/src/main/java/org/pegdown/Parser.java#L1659-L1674 |
117,276 | sirthias/pegdown | src/main/java/org/pegdown/Parser.java | Parser.parseInternal | public RootNode parseInternal(StringBuilderVar block) {
char[] chars = block.getChars();
int[] ixMap = new int[chars.length + 1]; // map of cleaned indices to original indices
// strip out CROSSED_OUT characters and build index map
StringBuilder clean = new StringBuilder();
... | java | public RootNode parseInternal(StringBuilderVar block) {
char[] chars = block.getChars();
int[] ixMap = new int[chars.length + 1]; // map of cleaned indices to original indices
// strip out CROSSED_OUT characters and build index map
StringBuilder clean = new StringBuilder();
... | [
"public",
"RootNode",
"parseInternal",
"(",
"StringBuilderVar",
"block",
")",
"{",
"char",
"[",
"]",
"chars",
"=",
"block",
".",
"getChars",
"(",
")",
";",
"int",
"[",
"]",
"ixMap",
"=",
"new",
"int",
"[",
"chars",
".",
"length",
"+",
"1",
"]",
";",
... | called for inner parses for list items and blockquotes | [
"called",
"for",
"inner",
"parses",
"for",
"list",
"items",
"and",
"blockquotes"
] | 19ca3d3d2bea5df19eb885260ab24f1200a16452 | https://github.com/sirthias/pegdown/blob/19ca3d3d2bea5df19eb885260ab24f1200a16452/src/main/java/org/pegdown/Parser.java#L1783-L1807 |
117,277 | sirthias/pegdown | src/main/java/org/pegdown/PegDownProcessor.java | PegDownProcessor.prepareSource | public char[] prepareSource(char[] source) {
char[] src = new char[source.length + 2];
System.arraycopy(source, 0, src, 0, source.length);
src[source.length] = '\n';
src[source.length + 1] = '\n';
return src;
} | java | public char[] prepareSource(char[] source) {
char[] src = new char[source.length + 2];
System.arraycopy(source, 0, src, 0, source.length);
src[source.length] = '\n';
src[source.length + 1] = '\n';
return src;
} | [
"public",
"char",
"[",
"]",
"prepareSource",
"(",
"char",
"[",
"]",
"source",
")",
"{",
"char",
"[",
"]",
"src",
"=",
"new",
"char",
"[",
"source",
".",
"length",
"+",
"2",
"]",
";",
"System",
".",
"arraycopy",
"(",
"source",
",",
"0",
",",
"src"... | Adds two trailing newlines.
@param source the markdown source to process
@return the processed source | [
"Adds",
"two",
"trailing",
"newlines",
"."
] | 19ca3d3d2bea5df19eb885260ab24f1200a16452 | https://github.com/sirthias/pegdown/blob/19ca3d3d2bea5df19eb885260ab24f1200a16452/src/main/java/org/pegdown/PegDownProcessor.java#L190-L196 |
117,278 | sirthias/pegdown | src/main/java/org/pegdown/plugins/PegDownPlugins.java | PegDownPlugins.builder | public static Builder builder(PegDownPlugins like) {
return builder().withInlinePluginRules(like.getInlinePluginRules()).withBlockPluginRules(like.getBlockPluginRules()).
withHtmlSerializer(like.serializerPlugins.toArray(new ToHtmlSerializerPlugin[0]));
} | java | public static Builder builder(PegDownPlugins like) {
return builder().withInlinePluginRules(like.getInlinePluginRules()).withBlockPluginRules(like.getBlockPluginRules()).
withHtmlSerializer(like.serializerPlugins.toArray(new ToHtmlSerializerPlugin[0]));
} | [
"public",
"static",
"Builder",
"builder",
"(",
"PegDownPlugins",
"like",
")",
"{",
"return",
"builder",
"(",
")",
".",
"withInlinePluginRules",
"(",
"like",
".",
"getInlinePluginRules",
"(",
")",
")",
".",
"withBlockPluginRules",
"(",
"like",
".",
"getBlockPlugi... | Create a builder that is a copy of the existing plugins | [
"Create",
"a",
"builder",
"that",
"is",
"a",
"copy",
"of",
"the",
"existing",
"plugins"
] | 19ca3d3d2bea5df19eb885260ab24f1200a16452 | https://github.com/sirthias/pegdown/blob/19ca3d3d2bea5df19eb885260ab24f1200a16452/src/main/java/org/pegdown/plugins/PegDownPlugins.java#L74-L77 |
117,279 | shevek/jarjar | jarjar-gradle/src/main/java/org/anarres/gradle/plugin/jarjar/JarjarTask.java | JarjarTask.getDestinationDir | public File getDestinationDir() {
File out = destinationDir;
if (out == null)
out = new File(getProject().getBuildDir(), "jarjar");
return out;
} | java | public File getDestinationDir() {
File out = destinationDir;
if (out == null)
out = new File(getProject().getBuildDir(), "jarjar");
return out;
} | [
"public",
"File",
"getDestinationDir",
"(",
")",
"{",
"File",
"out",
"=",
"destinationDir",
";",
"if",
"(",
"out",
"==",
"null",
")",
"out",
"=",
"new",
"File",
"(",
"getProject",
"(",
")",
".",
"getBuildDir",
"(",
")",
",",
"\"jarjar\"",
")",
";",
"... | Returns the directory where the archive is generated into.
@return the directory | [
"Returns",
"the",
"directory",
"where",
"the",
"archive",
"is",
"generated",
"into",
"."
] | 59b9f04970d078184a0d1ac4eeb548215b8e2bc2 | https://github.com/shevek/jarjar/blob/59b9f04970d078184a0d1ac4eeb548215b8e2bc2/jarjar-gradle/src/main/java/org/anarres/gradle/plugin/jarjar/JarjarTask.java#L114-L119 |
117,280 | shevek/jarjar | jarjar-gradle/src/main/java/org/anarres/gradle/plugin/jarjar/JarjarTask.java | JarjarTask.getDestinationName | public String getDestinationName() {
String out = destinationName;
if (out == null)
out = getName() + ".jar";
return out;
} | java | public String getDestinationName() {
String out = destinationName;
if (out == null)
out = getName() + ".jar";
return out;
} | [
"public",
"String",
"getDestinationName",
"(",
")",
"{",
"String",
"out",
"=",
"destinationName",
";",
"if",
"(",
"out",
"==",
"null",
")",
"out",
"=",
"getName",
"(",
")",
"+",
"\".jar\"",
";",
"return",
"out",
";",
"}"
] | Returns the file name of the generated archive.
@return the name | [
"Returns",
"the",
"file",
"name",
"of",
"the",
"generated",
"archive",
"."
] | 59b9f04970d078184a0d1ac4eeb548215b8e2bc2 | https://github.com/shevek/jarjar/blob/59b9f04970d078184a0d1ac4eeb548215b8e2bc2/jarjar-gradle/src/main/java/org/anarres/gradle/plugin/jarjar/JarjarTask.java#L130-L135 |
117,281 | zrlio/disni | src/main/java/com/ibm/disni/RdmaCmProcessor.java | RdmaCmProcessor.close | public synchronized void close() throws IOException, InterruptedException {
logger.info("shutting down cm processor");
if (closed.get()){
return;
}
closed.set(true);
thread.join();
logger.info("cm processor down");
cmChannel.destroyEventChannel();
logger.info("cm channel down");
} | java | public synchronized void close() throws IOException, InterruptedException {
logger.info("shutting down cm processor");
if (closed.get()){
return;
}
closed.set(true);
thread.join();
logger.info("cm processor down");
cmChannel.destroyEventChannel();
logger.info("cm channel down");
} | [
"public",
"synchronized",
"void",
"close",
"(",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"logger",
".",
"info",
"(",
"\"shutting down cm processor\"",
")",
";",
"if",
"(",
"closed",
".",
"get",
"(",
")",
")",
"{",
"return",
";",
"}",
... | Close the event loop.
@throws Exception the exception | [
"Close",
"the",
"event",
"loop",
"."
] | cfcee63cf054fb151f459357f601d7717f658b6c | https://github.com/zrlio/disni/blob/cfcee63cf054fb151f459357f601d7717f658b6c/src/main/java/com/ibm/disni/RdmaCmProcessor.java#L91-L102 |
117,282 | zrlio/disni | src/main/java/com/ibm/disni/RdmaServerEndpoint.java | RdmaServerEndpoint.accept | public C accept() throws IOException {
try {
synchronized(this){
if (connState != CONN_STATE_READY_FOR_ACCEPT) {
throw new IOException("bind needs to be called before accept (1), current state =" + connState);
}
logger.info("starting accept");
if (requested.peek() == null){
wait();
}
... | java | public C accept() throws IOException {
try {
synchronized(this){
if (connState != CONN_STATE_READY_FOR_ACCEPT) {
throw new IOException("bind needs to be called before accept (1), current state =" + connState);
}
logger.info("starting accept");
if (requested.peek() == null){
wait();
}
... | [
"public",
"C",
"accept",
"(",
")",
"throws",
"IOException",
"{",
"try",
"{",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"connState",
"!=",
"CONN_STATE_READY_FOR_ACCEPT",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"bind needs to be called before accept ... | Extract the first connection request on the queue of pending connections.
@throws Exception on failure. | [
"Extract",
"the",
"first",
"connection",
"request",
"on",
"the",
"queue",
"of",
"pending",
"connections",
"."
] | cfcee63cf054fb151f459357f601d7717f658b6c | https://github.com/zrlio/disni/blob/cfcee63cf054fb151f459357f601d7717f658b6c/src/main/java/com/ibm/disni/RdmaServerEndpoint.java#L121-L139 |
117,283 | zrlio/disni | src/main/java/com/ibm/disni/RdmaEndpoint.java | RdmaEndpoint.close | public synchronized void close() throws IOException, InterruptedException {
if (isClosed){
return;
}
logger.info("closing client endpoint");
if (connState == CONN_STATE_CONNECTED) {
idPriv.disconnect();
this.wait(1000);
}
if (connState >= CONN_STATE_RESOURCES_ALLOCATED) {
idPriv.destroyQP();
... | java | public synchronized void close() throws IOException, InterruptedException {
if (isClosed){
return;
}
logger.info("closing client endpoint");
if (connState == CONN_STATE_CONNECTED) {
idPriv.disconnect();
this.wait(1000);
}
if (connState >= CONN_STATE_RESOURCES_ALLOCATED) {
idPriv.destroyQP();
... | [
"public",
"synchronized",
"void",
"close",
"(",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"if",
"(",
"isClosed",
")",
"{",
"return",
";",
"}",
"logger",
".",
"info",
"(",
"\"closing client endpoint\"",
")",
";",
"if",
"(",
"connState",
... | Close this endpoint.
This closes the connection and free's all the resources, e.g., queue pair.
@throws InterruptedException
@throws Exception the exception | [
"Close",
"this",
"endpoint",
"."
] | cfcee63cf054fb151f459357f601d7717f658b6c | https://github.com/zrlio/disni/blob/cfcee63cf054fb151f459357f601d7717f658b6c/src/main/java/com/ibm/disni/RdmaEndpoint.java#L199-L216 |
117,284 | zrlio/disni | src/main/java/com/ibm/disni/RdmaEndpoint.java | RdmaEndpoint.postRecv | public SVCPostRecv postRecv(List<IbvRecvWR> recvList) throws IOException {
return qp.postRecv(recvList, null);
} | java | public SVCPostRecv postRecv(List<IbvRecvWR> recvList) throws IOException {
return qp.postRecv(recvList, null);
} | [
"public",
"SVCPostRecv",
"postRecv",
"(",
"List",
"<",
"IbvRecvWR",
">",
"recvList",
")",
"throws",
"IOException",
"{",
"return",
"qp",
".",
"postRecv",
"(",
"recvList",
",",
"null",
")",
";",
"}"
] | Post a receive operation on this endpoint.
@param recvList list of receive requests.
@return a stateful verb call (SVC) ready to execute the receive operations.
@throws Exception on failure. | [
"Post",
"a",
"receive",
"operation",
"on",
"this",
"endpoint",
"."
] | cfcee63cf054fb151f459357f601d7717f658b6c | https://github.com/zrlio/disni/blob/cfcee63cf054fb151f459357f601d7717f658b6c/src/main/java/com/ibm/disni/RdmaEndpoint.java#L283-L285 |
117,285 | zrlio/disni | src/main/java/com/ibm/disni/RdmaEndpoint.java | RdmaEndpoint.postSend | public SVCPostSend postSend(List<IbvSendWR> sendList)
throws IOException {
return qp.postSend(sendList, null);
} | java | public SVCPostSend postSend(List<IbvSendWR> sendList)
throws IOException {
return qp.postSend(sendList, null);
} | [
"public",
"SVCPostSend",
"postSend",
"(",
"List",
"<",
"IbvSendWR",
">",
"sendList",
")",
"throws",
"IOException",
"{",
"return",
"qp",
".",
"postSend",
"(",
"sendList",
",",
"null",
")",
";",
"}"
] | Post a send operation on this endpoint.
@param sendList list of send requests.
@return a stateful verb call (SVC) ready to execute the send operations.
@throws Exception on failure. | [
"Post",
"a",
"send",
"operation",
"on",
"this",
"endpoint",
"."
] | cfcee63cf054fb151f459357f601d7717f658b6c | https://github.com/zrlio/disni/blob/cfcee63cf054fb151f459357f601d7717f658b6c/src/main/java/com/ibm/disni/RdmaEndpoint.java#L294-L297 |
117,286 | jdereg/java-util | src/main/java/com/cedarsoftware/util/UrlUtilities.java | UrlUtilities.getConnection | public static URLConnection getConnection(URL url, Map inCookies, boolean input, boolean output, boolean cache, boolean allowAllCerts) throws IOException
{
URLConnection c = url.openConnection();
c.setRequestProperty("Accept-Encoding", "gzip, deflate");
c.setAllowUserInteraction(false);
... | java | public static URLConnection getConnection(URL url, Map inCookies, boolean input, boolean output, boolean cache, boolean allowAllCerts) throws IOException
{
URLConnection c = url.openConnection();
c.setRequestProperty("Accept-Encoding", "gzip, deflate");
c.setAllowUserInteraction(false);
... | [
"public",
"static",
"URLConnection",
"getConnection",
"(",
"URL",
"url",
",",
"Map",
"inCookies",
",",
"boolean",
"input",
",",
"boolean",
"output",
",",
"boolean",
"cache",
",",
"boolean",
"allowAllCerts",
")",
"throws",
"IOException",
"{",
"URLConnection",
"c"... | Gets a connection from a url. All getConnection calls should go through this code.
@param inCookies Supply cookie Map (received from prior setCookies calls from server)
@param input boolean indicating whether this connection will be used for input
@param output boolean indicating whether this connection will be used f... | [
"Gets",
"a",
"connection",
"from",
"a",
"url",
".",
"All",
"getConnection",
"calls",
"should",
"go",
"through",
"this",
"code",
"."
] | a2dce61aed16d6454ee575174dda1ba6bff0015c | https://github.com/jdereg/java-util/blob/a2dce61aed16d6454ee575174dda1ba6bff0015c/src/main/java/com/cedarsoftware/util/UrlUtilities.java#L607-L652 |
117,287 | jdereg/java-util | src/main/java/com/cedarsoftware/util/ExceptionUtilities.java | ExceptionUtilities.safelyIgnoreException | public static void safelyIgnoreException(Throwable t)
{
if (t instanceof ThreadDeath)
{
throw (ThreadDeath) t;
}
if (t instanceof OutOfMemoryError)
{
throw (OutOfMemoryError) t;
}
} | java | public static void safelyIgnoreException(Throwable t)
{
if (t instanceof ThreadDeath)
{
throw (ThreadDeath) t;
}
if (t instanceof OutOfMemoryError)
{
throw (OutOfMemoryError) t;
}
} | [
"public",
"static",
"void",
"safelyIgnoreException",
"(",
"Throwable",
"t",
")",
"{",
"if",
"(",
"t",
"instanceof",
"ThreadDeath",
")",
"{",
"throw",
"(",
"ThreadDeath",
")",
"t",
";",
"}",
"if",
"(",
"t",
"instanceof",
"OutOfMemoryError",
")",
"{",
"throw... | Safely Ignore a Throwable or rethrow if it is a Throwable that should
not be ignored.
@param t | [
"Safely",
"Ignore",
"a",
"Throwable",
"or",
"rethrow",
"if",
"it",
"is",
"a",
"Throwable",
"that",
"should",
"not",
"be",
"ignored",
"."
] | a2dce61aed16d6454ee575174dda1ba6bff0015c | https://github.com/jdereg/java-util/blob/a2dce61aed16d6454ee575174dda1ba6bff0015c/src/main/java/com/cedarsoftware/util/ExceptionUtilities.java#L33-L45 |
117,288 | jdereg/java-util | src/main/java/com/cedarsoftware/util/GraphComparator.java | GraphComparator.compareSets | private static void compareSets(Delta delta, Collection deltas, LinkedList stack, ID idFetcher)
{
Set srcSet = (Set) delta.srcValue;
Set targetSet = (Set) delta.targetValue;
// Create ID to Object map for target Set
Map targetIdToValue = new HashMap();
for (Object targetValu... | java | private static void compareSets(Delta delta, Collection deltas, LinkedList stack, ID idFetcher)
{
Set srcSet = (Set) delta.srcValue;
Set targetSet = (Set) delta.targetValue;
// Create ID to Object map for target Set
Map targetIdToValue = new HashMap();
for (Object targetValu... | [
"private",
"static",
"void",
"compareSets",
"(",
"Delta",
"delta",
",",
"Collection",
"deltas",
",",
"LinkedList",
"stack",
",",
"ID",
"idFetcher",
")",
"{",
"Set",
"srcSet",
"=",
"(",
"Set",
")",
"delta",
".",
"srcValue",
";",
"Set",
"targetSet",
"=",
"... | Deeply compare two Sets and generate the appropriate 'add' or 'remove' commands
to rectify their differences. | [
"Deeply",
"compare",
"two",
"Sets",
"and",
"generate",
"the",
"appropriate",
"add",
"or",
"remove",
"commands",
"to",
"rectify",
"their",
"differences",
"."
] | a2dce61aed16d6454ee575174dda1ba6bff0015c | https://github.com/jdereg/java-util/blob/a2dce61aed16d6454ee575174dda1ba6bff0015c/src/main/java/com/cedarsoftware/util/GraphComparator.java#L666-L739 |
117,289 | jdereg/java-util | src/main/java/com/cedarsoftware/util/GraphComparator.java | GraphComparator.compareMaps | private static void compareMaps(Delta delta, Collection deltas, LinkedList stack, ID idFetcher)
{
Map<Object, Object> srcMap = (Map<Object, Object>) delta.srcValue;
Map<Object, Object> targetMap = (Map<Object, Object>) delta.targetValue;
// Walk source Map keys and see if they exist in targ... | java | private static void compareMaps(Delta delta, Collection deltas, LinkedList stack, ID idFetcher)
{
Map<Object, Object> srcMap = (Map<Object, Object>) delta.srcValue;
Map<Object, Object> targetMap = (Map<Object, Object>) delta.targetValue;
// Walk source Map keys and see if they exist in targ... | [
"private",
"static",
"void",
"compareMaps",
"(",
"Delta",
"delta",
",",
"Collection",
"deltas",
",",
"LinkedList",
"stack",
",",
"ID",
"idFetcher",
")",
"{",
"Map",
"<",
"Object",
",",
"Object",
">",
"srcMap",
"=",
"(",
"Map",
"<",
"Object",
",",
"Object... | Deeply compare two Maps and generate the appropriate 'put' or 'remove' commands
to rectify their differences. | [
"Deeply",
"compare",
"two",
"Maps",
"and",
"generate",
"the",
"appropriate",
"put",
"or",
"remove",
"commands",
"to",
"rectify",
"their",
"differences",
"."
] | a2dce61aed16d6454ee575174dda1ba6bff0015c | https://github.com/jdereg/java-util/blob/a2dce61aed16d6454ee575174dda1ba6bff0015c/src/main/java/com/cedarsoftware/util/GraphComparator.java#L745-L807 |
117,290 | jdereg/java-util | src/main/java/com/cedarsoftware/util/GraphComparator.java | GraphComparator.compareLists | private static void compareLists(Delta delta, Collection deltas, LinkedList stack, ID idFetcher)
{
List srcList = (List) delta.srcValue;
List targetList = (List) delta.targetValue;
int srcLen = srcList.size();
int targetLen = targetList.size();
if (srcLen != targetLen)
... | java | private static void compareLists(Delta delta, Collection deltas, LinkedList stack, ID idFetcher)
{
List srcList = (List) delta.srcValue;
List targetList = (List) delta.targetValue;
int srcLen = srcList.size();
int targetLen = targetList.size();
if (srcLen != targetLen)
... | [
"private",
"static",
"void",
"compareLists",
"(",
"Delta",
"delta",
",",
"Collection",
"deltas",
",",
"LinkedList",
"stack",
",",
"ID",
"idFetcher",
")",
"{",
"List",
"srcList",
"=",
"(",
"List",
")",
"delta",
".",
"srcValue",
";",
"List",
"targetList",
"=... | Deeply compare two Lists and generate the appropriate 'resize' or 'set' commands
to rectify their differences. | [
"Deeply",
"compare",
"two",
"Lists",
"and",
"generate",
"the",
"appropriate",
"resize",
"or",
"set",
"commands",
"to",
"rectify",
"their",
"differences",
"."
] | a2dce61aed16d6454ee575174dda1ba6bff0015c | https://github.com/jdereg/java-util/blob/a2dce61aed16d6454ee575174dda1ba6bff0015c/src/main/java/com/cedarsoftware/util/GraphComparator.java#L820-L876 |
117,291 | jdereg/java-util | src/main/java/com/cedarsoftware/util/EncryptionUtilities.java | EncryptionUtilities.createAesCipher | public static Cipher createAesCipher(Key key, int mode) throws Exception
{
// Use password key as seed for IV (must be 16 bytes)
MessageDigest d = getMD5Digest();
d.update(key.getEncoded());
byte[] iv = d.digest();
AlgorithmParameterSpec paramSpec = new IvParameterSpec(iv);
... | java | public static Cipher createAesCipher(Key key, int mode) throws Exception
{
// Use password key as seed for IV (must be 16 bytes)
MessageDigest d = getMD5Digest();
d.update(key.getEncoded());
byte[] iv = d.digest();
AlgorithmParameterSpec paramSpec = new IvParameterSpec(iv);
... | [
"public",
"static",
"Cipher",
"createAesCipher",
"(",
"Key",
"key",
",",
"int",
"mode",
")",
"throws",
"Exception",
"{",
"// Use password key as seed for IV (must be 16 bytes)",
"MessageDigest",
"d",
"=",
"getMD5Digest",
"(",
")",
";",
"d",
".",
"update",
"(",
"ke... | Creates a Cipher from the passed in key, using the passed in mode.
@param key SecretKeySpec
@param mode Cipher.ENCRYPT_MODE or Cipher.DECRYPT_MODE
@return Cipher instance created with the passed in key and mode. | [
"Creates",
"a",
"Cipher",
"from",
"the",
"passed",
"in",
"key",
"using",
"the",
"passed",
"in",
"mode",
"."
] | a2dce61aed16d6454ee575174dda1ba6bff0015c | https://github.com/jdereg/java-util/blob/a2dce61aed16d6454ee575174dda1ba6bff0015c/src/main/java/com/cedarsoftware/util/EncryptionUtilities.java#L179-L190 |
117,292 | jdereg/java-util | src/main/java/com/cedarsoftware/util/EncryptionUtilities.java | EncryptionUtilities.encrypt | public static String encrypt(String key, String content)
{
try
{
return ByteUtilities.encode(createAesEncryptionCipher(key).doFinal(content.getBytes(StandardCharsets.UTF_8)));
}
catch (Exception e)
{
throw new IllegalStateException("Error occurred encr... | java | public static String encrypt(String key, String content)
{
try
{
return ByteUtilities.encode(createAesEncryptionCipher(key).doFinal(content.getBytes(StandardCharsets.UTF_8)));
}
catch (Exception e)
{
throw new IllegalStateException("Error occurred encr... | [
"public",
"static",
"String",
"encrypt",
"(",
"String",
"key",
",",
"String",
"content",
")",
"{",
"try",
"{",
"return",
"ByteUtilities",
".",
"encode",
"(",
"createAesEncryptionCipher",
"(",
"key",
")",
".",
"doFinal",
"(",
"content",
".",
"getBytes",
"(",
... | Get hex String of content String encrypted. | [
"Get",
"hex",
"String",
"of",
"content",
"String",
"encrypted",
"."
] | a2dce61aed16d6454ee575174dda1ba6bff0015c | https://github.com/jdereg/java-util/blob/a2dce61aed16d6454ee575174dda1ba6bff0015c/src/main/java/com/cedarsoftware/util/EncryptionUtilities.java#L195-L205 |
117,293 | jdereg/java-util | src/main/java/com/cedarsoftware/util/EncryptionUtilities.java | EncryptionUtilities.decrypt | public static String decrypt(String key, String hexStr)
{
try
{
return new String(createAesDecryptionCipher(key).doFinal(ByteUtilities.decode(hexStr)));
}
catch (Exception e)
{
throw new IllegalStateException("Error occurred decrypting data", e);
... | java | public static String decrypt(String key, String hexStr)
{
try
{
return new String(createAesDecryptionCipher(key).doFinal(ByteUtilities.decode(hexStr)));
}
catch (Exception e)
{
throw new IllegalStateException("Error occurred decrypting data", e);
... | [
"public",
"static",
"String",
"decrypt",
"(",
"String",
"key",
",",
"String",
"hexStr",
")",
"{",
"try",
"{",
"return",
"new",
"String",
"(",
"createAesDecryptionCipher",
"(",
"key",
")",
".",
"doFinal",
"(",
"ByteUtilities",
".",
"decode",
"(",
"hexStr",
... | Get unencrypted String from encrypted hex String | [
"Get",
"unencrypted",
"String",
"from",
"encrypted",
"hex",
"String"
] | a2dce61aed16d6454ee575174dda1ba6bff0015c | https://github.com/jdereg/java-util/blob/a2dce61aed16d6454ee575174dda1ba6bff0015c/src/main/java/com/cedarsoftware/util/EncryptionUtilities.java#L222-L232 |
117,294 | jdereg/java-util | src/main/java/com/cedarsoftware/util/MapUtilities.java | MapUtilities.get | public static <T> T get(Map map, String key, T def) {
Object val = map.get(key);
return val == null ? def : (T)val;
} | java | public static <T> T get(Map map, String key, T def) {
Object val = map.get(key);
return val == null ? def : (T)val;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"get",
"(",
"Map",
"map",
",",
"String",
"key",
",",
"T",
"def",
")",
"{",
"Object",
"val",
"=",
"map",
".",
"get",
"(",
"key",
")",
";",
"return",
"val",
"==",
"null",
"?",
"def",
":",
"(",
"T",
")",
... | Retrieves a value from a map by key
@param map Map to retrieve item from
@param key the key whose associated value is to be returned
@param def value to return if item was not found.
@return Returns a string value that was found at the location key.
If the item is null then the def value is sent back.
If the item is n... | [
"Retrieves",
"a",
"value",
"from",
"a",
"map",
"by",
"key"
] | a2dce61aed16d6454ee575174dda1ba6bff0015c | https://github.com/jdereg/java-util/blob/a2dce61aed16d6454ee575174dda1ba6bff0015c/src/main/java/com/cedarsoftware/util/MapUtilities.java#L47-L50 |
117,295 | jdereg/java-util | src/main/java/com/cedarsoftware/util/StringUtilities.java | StringUtilities.decode | public static byte[] decode(String s)
{
int len = s.length();
if (len % 2 != 0)
{
return null;
}
byte[] bytes = new byte[len / 2];
int pos = 0;
for (int i = 0; i < len; i += 2)
{
byte hi = (byte) Character.digit(s.charAt(i), 1... | java | public static byte[] decode(String s)
{
int len = s.length();
if (len % 2 != 0)
{
return null;
}
byte[] bytes = new byte[len / 2];
int pos = 0;
for (int i = 0; i < len; i += 2)
{
byte hi = (byte) Character.digit(s.charAt(i), 1... | [
"public",
"static",
"byte",
"[",
"]",
"decode",
"(",
"String",
"s",
")",
"{",
"int",
"len",
"=",
"s",
".",
"length",
"(",
")",
";",
"if",
"(",
"len",
"%",
"2",
"!=",
"0",
")",
"{",
"return",
"null",
";",
"}",
"byte",
"[",
"]",
"bytes",
"=",
... | If string is not even length, return null. | [
"If",
"string",
"is",
"not",
"even",
"length",
"return",
"null",
"."
] | a2dce61aed16d6454ee575174dda1ba6bff0015c | https://github.com/jdereg/java-util/blob/a2dce61aed16d6454ee575174dda1ba6bff0015c/src/main/java/com/cedarsoftware/util/StringUtilities.java#L121-L140 |
117,296 | jdereg/java-util | src/main/java/com/cedarsoftware/util/StringUtilities.java | StringUtilities.damerauLevenshteinDistance | public static int damerauLevenshteinDistance(CharSequence source, CharSequence target)
{
if (source == null || "".equals(source))
{
return target == null || "".equals(target) ? 0 : target.length();
}
else if (target == null || "".equals(target))
{
retu... | java | public static int damerauLevenshteinDistance(CharSequence source, CharSequence target)
{
if (source == null || "".equals(source))
{
return target == null || "".equals(target) ? 0 : target.length();
}
else if (target == null || "".equals(target))
{
retu... | [
"public",
"static",
"int",
"damerauLevenshteinDistance",
"(",
"CharSequence",
"source",
",",
"CharSequence",
"target",
")",
"{",
"if",
"(",
"source",
"==",
"null",
"||",
"\"\"",
".",
"equals",
"(",
"source",
")",
")",
"{",
"return",
"target",
"==",
"null",
... | Calculate the Damerau-Levenshtein Distance between two strings. The basic difference
between this algorithm and the general Levenshtein algorithm is that damerau-Levenshtein
counts a swap of two characters next to each other as 1 instead of 2. This breaks the
'triangular equality', which makes it unusable for Metric ... | [
"Calculate",
"the",
"Damerau",
"-",
"Levenshtein",
"Distance",
"between",
"two",
"strings",
".",
"The",
"basic",
"difference",
"between",
"this",
"algorithm",
"and",
"the",
"general",
"Levenshtein",
"algorithm",
"is",
"that",
"damerau",
"-",
"Levenshtein",
"counts... | a2dce61aed16d6454ee575174dda1ba6bff0015c | https://github.com/jdereg/java-util/blob/a2dce61aed16d6454ee575174dda1ba6bff0015c/src/main/java/com/cedarsoftware/util/StringUtilities.java#L307-L383 |
117,297 | jdereg/java-util | src/main/java/com/cedarsoftware/util/StringUtilities.java | StringUtilities.hashCodeIgnoreCase | public static int hashCodeIgnoreCase(String s)
{
if (s == null)
{
return 0;
}
int hash = 0;
int len = s.length();
for (int i = 0; i < len; i++)
{
char c = Character.toLowerCase(s.charAt(i));
hash = 31 * hash + c;
}
... | java | public static int hashCodeIgnoreCase(String s)
{
if (s == null)
{
return 0;
}
int hash = 0;
int len = s.length();
for (int i = 0; i < len; i++)
{
char c = Character.toLowerCase(s.charAt(i));
hash = 31 * hash + c;
}
... | [
"public",
"static",
"int",
"hashCodeIgnoreCase",
"(",
"String",
"s",
")",
"{",
"if",
"(",
"s",
"==",
"null",
")",
"{",
"return",
"0",
";",
"}",
"int",
"hash",
"=",
"0",
";",
"int",
"len",
"=",
"s",
".",
"length",
"(",
")",
";",
"for",
"(",
"int... | Get the hashCode of a String, insensitive to case, without any new Strings
being created on the heap.
@param s String input
@return int hashCode of input String insensitive to case | [
"Get",
"the",
"hashCode",
"of",
"a",
"String",
"insensitive",
"to",
"case",
"without",
"any",
"new",
"Strings",
"being",
"created",
"on",
"the",
"heap",
"."
] | a2dce61aed16d6454ee575174dda1ba6bff0015c | https://github.com/jdereg/java-util/blob/a2dce61aed16d6454ee575174dda1ba6bff0015c/src/main/java/com/cedarsoftware/util/StringUtilities.java#L489-L503 |
117,298 | jdereg/java-util | src/main/java/com/cedarsoftware/util/MathUtilities.java | MathUtilities.maximum | public static BigDecimal maximum(BigDecimal... values)
{
int len = values.length;
if (len == 1)
{
if (values[0] == null)
{
throw new IllegalArgumentException("Cannot passed null BigDecimal entry to maximum()");
}
return values[0... | java | public static BigDecimal maximum(BigDecimal... values)
{
int len = values.length;
if (len == 1)
{
if (values[0] == null)
{
throw new IllegalArgumentException("Cannot passed null BigDecimal entry to maximum()");
}
return values[0... | [
"public",
"static",
"BigDecimal",
"maximum",
"(",
"BigDecimal",
"...",
"values",
")",
"{",
"int",
"len",
"=",
"values",
".",
"length",
";",
"if",
"(",
"len",
"==",
"1",
")",
"{",
"if",
"(",
"values",
"[",
"0",
"]",
"==",
"null",
")",
"{",
"throw",
... | Calculate the maximum value from an array of values.
@param values Array of values.
@return maximum value of the provided set. | [
"Calculate",
"the",
"maximum",
"value",
"from",
"an",
"array",
"of",
"values",
"."
] | a2dce61aed16d6454ee575174dda1ba6bff0015c | https://github.com/jdereg/java-util/blob/a2dce61aed16d6454ee575174dda1ba6bff0015c/src/main/java/com/cedarsoftware/util/MathUtilities.java#L207-L230 |
117,299 | jdereg/java-util | src/main/java/com/cedarsoftware/util/DeepEquals.java | DeepEquals.compareOrderedCollection | private static boolean compareOrderedCollection(Collection col1, Collection col2, Deque stack, Set visited)
{
// Same instance check already performed...
if (col1.size() != col2.size())
{
return false;
}
Iterator i1 = col1.iterator();
Iterator i2 = col2.... | java | private static boolean compareOrderedCollection(Collection col1, Collection col2, Deque stack, Set visited)
{
// Same instance check already performed...
if (col1.size() != col2.size())
{
return false;
}
Iterator i1 = col1.iterator();
Iterator i2 = col2.... | [
"private",
"static",
"boolean",
"compareOrderedCollection",
"(",
"Collection",
"col1",
",",
"Collection",
"col2",
",",
"Deque",
"stack",
",",
"Set",
"visited",
")",
"{",
"// Same instance check already performed...",
"if",
"(",
"col1",
".",
"size",
"(",
")",
"!=",... | Deeply compare two Collections that must be same length and in same order.
@param col1 First collection of items to compare
@param col2 Second collection of items to compare
@param stack add items to compare to the Stack (Stack versus recursion)
@param visited Set of objects already compared (prevents cycles)
value of ... | [
"Deeply",
"compare",
"two",
"Collections",
"that",
"must",
"be",
"same",
"length",
"and",
"in",
"same",
"order",
"."
] | a2dce61aed16d6454ee575174dda1ba6bff0015c | https://github.com/jdereg/java-util/blob/a2dce61aed16d6454ee575174dda1ba6bff0015c/src/main/java/com/cedarsoftware/util/DeepEquals.java#L411-L432 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.