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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
48,100 | aol/cyclops | cyclops-pure/src/main/java/cyclops/hkt/Active.java | Active.custom | public <S,R> Active<W,R> custom(Function<? super Higher<W, T>,? extends S> narrow,Function<? super S,? extends Higher<W,R>> fn){
return Active.of(fn.apply(narrow.apply(single)),def1);
} | java | public <S,R> Active<W,R> custom(Function<? super Higher<W, T>,? extends S> narrow,Function<? super S,? extends Higher<W,R>> fn){
return Active.of(fn.apply(narrow.apply(single)),def1);
} | [
"public",
"<",
"S",
",",
"R",
">",
"Active",
"<",
"W",
",",
"R",
">",
"custom",
"(",
"Function",
"<",
"?",
"super",
"Higher",
"<",
"W",
",",
"T",
">",
",",
"?",
"extends",
"S",
">",
"narrow",
",",
"Function",
"<",
"?",
"super",
"S",
",",
"?",... | Perform a custom operation
<pre>
{@code
Active<list,Integer> active = Active.of(ListX.of(1,2,3), ListX.Instances.definitions());
Active<list, ListX<Integer>> grouped = active.custom(ListX::narrowK, l -> l.grouped(10));
}
</pre>
@param narrow Function that narrows Higher Kinded encoding to it's concrete type
@param fn... | [
"Perform",
"a",
"custom",
"operation"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-pure/src/main/java/cyclops/hkt/Active.java#L89-L92 |
48,101 | aol/cyclops | cyclops/src/main/java/com/oath/cyclops/util/box/Mutable.java | Mutable.fromExternal | public static <T> Mutable<T> fromExternal(final Supplier<T> s, final Consumer<T> c) {
return new Mutable<T>() {
@Override
public T get() {
return s.get();
}
@Override
public Mutable<T> set(final T value) {
c.accept(valu... | java | public static <T> Mutable<T> fromExternal(final Supplier<T> s, final Consumer<T> c) {
return new Mutable<T>() {
@Override
public T get() {
return s.get();
}
@Override
public Mutable<T> set(final T value) {
c.accept(valu... | [
"public",
"static",
"<",
"T",
">",
"Mutable",
"<",
"T",
">",
"fromExternal",
"(",
"final",
"Supplier",
"<",
"T",
">",
"s",
",",
"final",
"Consumer",
"<",
"T",
">",
"c",
")",
"{",
"return",
"new",
"Mutable",
"<",
"T",
">",
"(",
")",
"{",
"@",
"O... | Construct a Mutable that gets and sets an external value using the provided Supplier and Consumer
e.g.
<pre>
{@code
Mutable<Integer> mutable = Mutable.from(()->this.value*2,val->this.value=val);
}
</pre>
@param s Supplier of an external value
@param c Consumer that sets an external value
@return Mutable that gets / ... | [
"Construct",
"a",
"Mutable",
"that",
"gets",
"and",
"sets",
"an",
"external",
"value",
"using",
"the",
"provided",
"Supplier",
"and",
"Consumer"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/util/box/Mutable.java#L88-L101 |
48,102 | aol/cyclops | cyclops/src/main/java/cyclops/function/PartialApplicator.java | PartialApplicator.partial5 | public static <T1, T2, T3, T4, T5, R> Supplier<R> partial5(final T1 t1, final T2 t2, final T3 t3, final T4 t4, final T5 t5,
final Function5<T1, T2, T3, T4, T5, R> quintFunc) {
return () -> quintFunc.apply(t1, t2, t3, t4, t5);
} | java | public static <T1, T2, T3, T4, T5, R> Supplier<R> partial5(final T1 t1, final T2 t2, final T3 t3, final T4 t4, final T5 t5,
final Function5<T1, T2, T3, T4, T5, R> quintFunc) {
return () -> quintFunc.apply(t1, t2, t3, t4, t5);
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
",",
"T5",
",",
"R",
">",
"Supplier",
"<",
"R",
">",
"partial5",
"(",
"final",
"T1",
"t1",
",",
"final",
"T2",
"t2",
",",
"final",
"T3",
"t3",
",",
"final",
"T4",
"t4",
",",
"fin... | Returns a Function with 4 arguments applied to the supplied QuintFunction
@param t1 Generic argument
@param t2 Generic argument
@param t3 Generic argument
@param t4 Generic argument
@param quintFunc Function that accepts 5 parameters
@param <T1> Generic argument type
@param <T2> Generic argument type
@param <T3> Generi... | [
"Returns",
"a",
"Function",
"with",
"4",
"arguments",
"applied",
"to",
"the",
"supplied",
"QuintFunction"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/function/PartialApplicator.java#L209-L212 |
48,103 | aol/cyclops | cyclops/src/main/java/cyclops/function/PartialApplicator.java | PartialApplicator.partial6 | public static <T1, T2, T3, T4, T5, T6, R> Supplier<R> partial6(final T1 t1, final T2 t2, final T3 t3, final T4 t4, final T5 t5, final T6 t6,
final Function6<T1, T2, T3, T4, T5, T6, R> hexFunc) {
return () -> hexFunc.apply(t1, t2, t3, t4, t5, t6);
} | java | public static <T1, T2, T3, T4, T5, T6, R> Supplier<R> partial6(final T1 t1, final T2 t2, final T3 t3, final T4 t4, final T5 t5, final T6 t6,
final Function6<T1, T2, T3, T4, T5, T6, R> hexFunc) {
return () -> hexFunc.apply(t1, t2, t3, t4, t5, t6);
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
",",
"T5",
",",
"T6",
",",
"R",
">",
"Supplier",
"<",
"R",
">",
"partial6",
"(",
"final",
"T1",
"t1",
",",
"final",
"T2",
"t2",
",",
"final",
"T3",
"t3",
",",
"final",
"T4",
"t4"... | Returns a Function with 5 arguments applied to the supplied HexFunction
@param t1 Generic argument
@param t2 Generic argument
@param t3 Generic argument
@param t4 Generic argument
@param t5 Generic argument
@param hexFunc Function that accepts 6 parameters
@param <T1> Generic argument type
@param <T2> Generic argument ... | [
"Returns",
"a",
"Function",
"with",
"5",
"arguments",
"applied",
"to",
"the",
"supplied",
"HexFunction"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/function/PartialApplicator.java#L310-L313 |
48,104 | aol/cyclops | cyclops-pure/src/main/java/cyclops/kinds/OptionalKind.java | OptionalKind.narrow | public static <T> OptionalKind<T> narrow(final Higher<optional, T> future) {
return (OptionalKind<T>)future;
} | java | public static <T> OptionalKind<T> narrow(final Higher<optional, T> future) {
return (OptionalKind<T>)future;
} | [
"public",
"static",
"<",
"T",
">",
"OptionalKind",
"<",
"T",
">",
"narrow",
"(",
"final",
"Higher",
"<",
"optional",
",",
"T",
">",
"future",
")",
"{",
"return",
"(",
"OptionalKind",
"<",
"T",
">",
")",
"future",
";",
"}"
] | Convert the raw Higher Kinded Type for OptionalKind types into the OptionalKind type definition class
@param future HKT encoded list into a OptionalKind
@return OptionalKind | [
"Convert",
"the",
"raw",
"Higher",
"Kinded",
"Type",
"for",
"OptionalKind",
"types",
"into",
"the",
"OptionalKind",
"type",
"definition",
"class"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-pure/src/main/java/cyclops/kinds/OptionalKind.java#L99-L101 |
48,105 | aol/cyclops | cyclops-pure/src/main/java/cyclops/kinds/OptionalKind.java | OptionalKind.narrowK | public static <T> Optional<T> narrowK(final Higher<optional, T> Optional) {
//has to be an OptionalKind as only OptionalKind can implement Higher<optional, T>
return ((OptionalKind<T>)Optional).boxed;
} | java | public static <T> Optional<T> narrowK(final Higher<optional, T> Optional) {
//has to be an OptionalKind as only OptionalKind can implement Higher<optional, T>
return ((OptionalKind<T>)Optional).boxed;
} | [
"public",
"static",
"<",
"T",
">",
"Optional",
"<",
"T",
">",
"narrowK",
"(",
"final",
"Higher",
"<",
"optional",
",",
"T",
">",
"Optional",
")",
"{",
"//has to be an OptionalKind as only OptionalKind can implement Higher<optional, T>",
"return",
"(",
"(",
"Optional... | Convert the HigherKindedType definition for a Optional into
@param Optional Type Constructor to convert back into narrowed type
@return Optional from Higher Kinded Type | [
"Convert",
"the",
"HigherKindedType",
"definition",
"for",
"a",
"Optional",
"into"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-pure/src/main/java/cyclops/kinds/OptionalKind.java#L108-L112 |
48,106 | aol/cyclops | cyclops/src/main/java/cyclops/companion/CompletableFutures.java | CompletableFutures.forEach3 | public static <T1, T2, R1, R2, R> CompletableFuture<R> forEach3(CompletableFuture<? extends T1> value1,
Function<? super T1, ? extends CompletableFuture<R1>> value2,
BiFunction<? super... | java | public static <T1, T2, R1, R2, R> CompletableFuture<R> forEach3(CompletableFuture<? extends T1> value1,
Function<? super T1, ? extends CompletableFuture<R1>> value2,
BiFunction<? super... | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"R1",
",",
"R2",
",",
"R",
">",
"CompletableFuture",
"<",
"R",
">",
"forEach3",
"(",
"CompletableFuture",
"<",
"?",
"extends",
"T1",
">",
"value1",
",",
"Function",
"<",
"?",
"super",
"T1",
",",
"?",
"... | Perform a For Comprehension over a CompletableFuture, accepting 2 generating function.
This results in a three level nested internal iteration over the provided CompletableFutures.
<pre>
{@code
import static com.oath.cyclops.reactor.CompletableFutures.forEach3;
forEach3(CompletableFuture.just(1),
a-> CompletableFutu... | [
"Perform",
"a",
"For",
"Comprehension",
"over",
"a",
"CompletableFuture",
"accepting",
"2",
"generating",
"function",
".",
"This",
"results",
"in",
"a",
"three",
"level",
"nested",
"internal",
"iteration",
"over",
"the",
"provided",
"CompletableFutures",
"."
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/CompletableFutures.java#L127-L146 |
48,107 | aol/cyclops | cyclops/src/main/java/cyclops/companion/CompletableFutures.java | CompletableFutures.forEach2 | public static <T, R1, R> CompletableFuture<R> forEach2(CompletableFuture<? extends T> value1, Function<? super T, CompletableFuture<R1>> value2,
BiFunction<? super T, ? super R1, ? extends R> yieldingFunction) {
return value1.thenCompose(in -> {
... | java | public static <T, R1, R> CompletableFuture<R> forEach2(CompletableFuture<? extends T> value1, Function<? super T, CompletableFuture<R1>> value2,
BiFunction<? super T, ? super R1, ? extends R> yieldingFunction) {
return value1.thenCompose(in -> {
... | [
"public",
"static",
"<",
"T",
",",
"R1",
",",
"R",
">",
"CompletableFuture",
"<",
"R",
">",
"forEach2",
"(",
"CompletableFuture",
"<",
"?",
"extends",
"T",
">",
"value1",
",",
"Function",
"<",
"?",
"super",
"T",
",",
"CompletableFuture",
"<",
"R1",
">"... | Perform a For Comprehension over a CompletableFuture, accepting a generating function.
This results in a two level nested internal iteration over the provided CompletableFutures.
<pre>
{@code
import static com.oath.cyclops.reactor.CompletableFutures.forEach;
forEach(CompletableFuture.just(1),
a-> CompletableFuture.j... | [
"Perform",
"a",
"For",
"Comprehension",
"over",
"a",
"CompletableFuture",
"accepting",
"a",
"generating",
"function",
".",
"This",
"results",
"in",
"a",
"two",
"level",
"nested",
"internal",
"iteration",
"over",
"the",
"provided",
"CompletableFutures",
"."
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/CompletableFutures.java#L170-L182 |
48,108 | aol/cyclops | cyclops/src/main/java/cyclops/companion/CompletableFutures.java | CompletableFutures.sequence | public static <T> CompletableFuture<ReactiveSeq<T>> sequence(final Stream<? extends CompletableFuture<T>> fts) {
return sequence(ReactiveSeq.fromStream((fts)));
} | java | public static <T> CompletableFuture<ReactiveSeq<T>> sequence(final Stream<? extends CompletableFuture<T>> fts) {
return sequence(ReactiveSeq.fromStream((fts)));
} | [
"public",
"static",
"<",
"T",
">",
"CompletableFuture",
"<",
"ReactiveSeq",
"<",
"T",
">",
">",
"sequence",
"(",
"final",
"Stream",
"<",
"?",
"extends",
"CompletableFuture",
"<",
"T",
">",
">",
"fts",
")",
"{",
"return",
"sequence",
"(",
"ReactiveSeq",
"... | Asynchronous sequence operation that convert a Stream of Futures to a Future with a Stream
<pre>
{@code
CompletableFuture<Seq<Integer>> futures =CompletableFuture.sequence(Seq.of(
CompletableFuture.completedFuture(10),
CompletableFuture.completedFuture(1)));
Seq.of(10,1)
}
</pre>
@param fts Stream of Futures to Seq... | [
"Asynchronous",
"sequence",
"operation",
"that",
"convert",
"a",
"Stream",
"of",
"Futures",
"to",
"a",
"Future",
"with",
"a",
"Stream"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/CompletableFutures.java#L222-L225 |
48,109 | aol/cyclops | cyclops/src/main/java/com/oath/cyclops/internal/stream/publisher/PublisherIterable.java | PublisherIterable.subscribe | static <T> void subscribe(Subscriber<? super T> s, Iterator<? extends T> it) {
if (it == null) {
error(s, new NullPointerException("The iterator is null"));
return;
}
boolean b;
try {
b = it.hasNext();
} catch (Throwable e) {
erro... | java | static <T> void subscribe(Subscriber<? super T> s, Iterator<? extends T> it) {
if (it == null) {
error(s, new NullPointerException("The iterator is null"));
return;
}
boolean b;
try {
b = it.hasNext();
} catch (Throwable e) {
erro... | [
"static",
"<",
"T",
">",
"void",
"subscribe",
"(",
"Subscriber",
"<",
"?",
"super",
"T",
">",
"s",
",",
"Iterator",
"<",
"?",
"extends",
"T",
">",
"it",
")",
"{",
"if",
"(",
"it",
"==",
"null",
")",
"{",
"error",
"(",
"s",
",",
"new",
"NullPoin... | Common method to take an Iterator as a source of values.
@param s
@param it | [
"Common",
"method",
"to",
"take",
"an",
"Iterator",
"as",
"a",
"source",
"of",
"values",
"."
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/internal/stream/publisher/PublisherIterable.java#L123-L145 |
48,110 | aol/cyclops | cyclops-futurestream/src/main/java/cyclops/futurestream/Pipes.java | Pipes.of | public static <K, V> Pipes<K, V> of(final Map<K, Adapter<V>> registered) {
Objects.requireNonNull(registered);
final Pipes<K, V> pipes = new Pipes<>();
pipes.registered.putAll(registered);
return pipes;
} | java | public static <K, V> Pipes<K, V> of(final Map<K, Adapter<V>> registered) {
Objects.requireNonNull(registered);
final Pipes<K, V> pipes = new Pipes<>();
pipes.registered.putAll(registered);
return pipes;
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"Pipes",
"<",
"K",
",",
"V",
">",
"of",
"(",
"final",
"Map",
"<",
"K",
",",
"Adapter",
"<",
"V",
">",
">",
"registered",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"registered",
")",
";",
"final"... | Construct a Pipes instance to manage a predefined Map of Adapaters
@param registered Adapters to register
@return Pipes instance to manage provided Adapters | [
"Construct",
"a",
"Pipes",
"instance",
"to",
"manage",
"a",
"predefined",
"Map",
"of",
"Adapaters"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/cyclops/futurestream/Pipes.java#L109-L114 |
48,111 | aol/cyclops | cyclops-futurestream/src/main/java/cyclops/futurestream/Pipes.java | Pipes.push | public void push(final K key, final V value) {
Optional.ofNullable(registered.get(key))
.ifPresent(a -> a.offer(value));
} | java | public void push(final K key, final V value) {
Optional.ofNullable(registered.get(key))
.ifPresent(a -> a.offer(value));
} | [
"public",
"void",
"push",
"(",
"final",
"K",
"key",
",",
"final",
"V",
"value",
")",
"{",
"Optional",
".",
"ofNullable",
"(",
"registered",
".",
"get",
"(",
"key",
")",
")",
".",
"ifPresent",
"(",
"a",
"->",
"a",
".",
"offer",
"(",
"value",
")",
... | Push a single value synchronously into the Adapter identified by the supplied Key,
if it exists
<pre>
{@code
Pipes<String,String> pipes = Pipes.of();
pipes.register("hello", new Queue<String>());
pipes.push("hello", "world");
on another thread
pipes.reactiveSeq("hello")
.getValue()
.forEach(System.out::println);
}... | [
"Push",
"a",
"single",
"value",
"synchronously",
"into",
"the",
"Adapter",
"identified",
"by",
"the",
"supplied",
"Key",
"if",
"it",
"exists"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/cyclops/futurestream/Pipes.java#L139-L142 |
48,112 | aol/cyclops | cyclops-futurestream/src/main/java/cyclops/futurestream/Pipes.java | Pipes.get | @SuppressWarnings({ "unchecked", "rawtypes" })
public Option<Adapter<V>> get(final K key) {
return Option.ofNullable((Adapter) registered.get(key));
} | java | @SuppressWarnings({ "unchecked", "rawtypes" })
public Option<Adapter<V>> get(final K key) {
return Option.ofNullable((Adapter) registered.get(key));
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"public",
"Option",
"<",
"Adapter",
"<",
"V",
">",
">",
"get",
"(",
"final",
"K",
"key",
")",
"{",
"return",
"Option",
".",
"ofNullable",
"(",
"(",
"Adapter",
")",
"regi... | Get the Adapter identified by the specified key
<pre>
{@code
//close an adapter
pipes.getValue("adapter-key")
.map(a->a.close())
.orElse(false); //Maybe is lazy - trigger action
}
</pre>
@param key : Adapter identifier
@return selected Queue | [
"Get",
"the",
"Adapter",
"identified",
"by",
"the",
"specified",
"key"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/cyclops/futurestream/Pipes.java#L161-L164 |
48,113 | aol/cyclops | cyclops-futurestream/src/main/java/cyclops/futurestream/Pipes.java | Pipes.futureStream | @SuppressWarnings({ "unchecked", "rawtypes" })
public Option<FutureStream<V>> futureStream(final K key, final LazyReact builder) {
return get(key).map(a -> builder.fromStream(a.stream()));
} | java | @SuppressWarnings({ "unchecked", "rawtypes" })
public Option<FutureStream<V>> futureStream(final K key, final LazyReact builder) {
return get(key).map(a -> builder.fromStream(a.stream()));
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"public",
"Option",
"<",
"FutureStream",
"<",
"V",
">",
">",
"futureStream",
"(",
"final",
"K",
"key",
",",
"final",
"LazyReact",
"builder",
")",
"{",
"return",
"get",
"(",
... | Create a FutureStream using the provided LazyReact futureStream builder
from the Adapter identified by the provided Key
<pre>
{@code
Pipes<String, Integer> bus = Pipes.of();
bus.register("reactor", QueueFactories.<Integer>boundedNonBlockingQueue(1000)
.build());
bus.publishTo("reactor",ReactiveSeq.of(10,20,30));
bus... | [
"Create",
"a",
"FutureStream",
"using",
"the",
"provided",
"LazyReact",
"futureStream",
"builder",
"from",
"the",
"Adapter",
"identified",
"by",
"the",
"provided",
"Key"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/cyclops/futurestream/Pipes.java#L201-L205 |
48,114 | aol/cyclops | cyclops-futurestream/src/main/java/cyclops/futurestream/Pipes.java | Pipes.reactiveSeq | @SuppressWarnings({ "unchecked", "rawtypes" })
public Option<ReactiveSeq<V>> reactiveSeq(final K key) {
return get(key).map(a -> a.stream());
} | java | @SuppressWarnings({ "unchecked", "rawtypes" })
public Option<ReactiveSeq<V>> reactiveSeq(final K key) {
return get(key).map(a -> a.stream());
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"public",
"Option",
"<",
"ReactiveSeq",
"<",
"V",
">",
">",
"reactiveSeq",
"(",
"final",
"K",
"key",
")",
"{",
"return",
"get",
"(",
"key",
")",
".",
"map",
"(",
"a",
... | Create a ReactiveSeq from the Adapter identified by the provided Key
<pre>
{@code
Queue<String> q = new Queue<>();
pipes.register("data-queue", q);
pipes.push("data-queue", "world");
on a separate thread
ReactiveSeq<String> stream = pipes.reactiveSeq("data-queue");
stream.forEach(System.out::println);
"world"
}
<... | [
"Create",
"a",
"ReactiveSeq",
"from",
"the",
"Adapter",
"identified",
"by",
"the",
"provided",
"Key"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/cyclops/futurestream/Pipes.java#L231-L234 |
48,115 | aol/cyclops | cyclops-futurestream/src/main/java/cyclops/futurestream/Pipes.java | Pipes.xValues | public ListX<V> xValues(final K key, final long x) {
return get(key).map(a -> a.stream()
.limit(x)
.to(ReactiveConvertableSequence::converter).listX())
.orElse(ListX.empty());
} | java | public ListX<V> xValues(final K key, final long x) {
return get(key).map(a -> a.stream()
.limit(x)
.to(ReactiveConvertableSequence::converter).listX())
.orElse(ListX.empty());
} | [
"public",
"ListX",
"<",
"V",
">",
"xValues",
"(",
"final",
"K",
"key",
",",
"final",
"long",
"x",
")",
"{",
"return",
"get",
"(",
"key",
")",
".",
"map",
"(",
"a",
"->",
"a",
".",
"stream",
"(",
")",
".",
"limit",
"(",
"x",
")",
".",
"to",
... | Extract the next x values from the Adapter identified by the provided Key
If the Adapter doesn't exist an zero List is returned
<pre>
{@code
Queue<String> q = new Queue<>();
pipes.register("hello", q);
pipes.push("hello", "world");
pipes.push("hello", "world2");
pipes.push("hello", "world3");
pipes.push("hello", "worl... | [
"Extract",
"the",
"next",
"x",
"values",
"from",
"the",
"Adapter",
"identified",
"by",
"the",
"provided",
"Key",
"If",
"the",
"Adapter",
"doesn",
"t",
"exist",
"an",
"zero",
"List",
"is",
"returned"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/cyclops/futurestream/Pipes.java#L262-L268 |
48,116 | aol/cyclops | cyclops-futurestream/src/main/java/cyclops/futurestream/Pipes.java | Pipes.oneValue | @SuppressWarnings({ "unchecked", "rawtypes" })
public Option<V> oneValue(final K key) {
final ValueSubscriber<V> sub = ValueSubscriber.subscriber();
return get(key).peek(a -> a.stream()
.subscribe(sub))
.flatMap(a -> sub.toMaybe());
} | java | @SuppressWarnings({ "unchecked", "rawtypes" })
public Option<V> oneValue(final K key) {
final ValueSubscriber<V> sub = ValueSubscriber.subscriber();
return get(key).peek(a -> a.stream()
.subscribe(sub))
.flatMap(a -> sub.toMaybe());
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"public",
"Option",
"<",
"V",
">",
"oneValue",
"(",
"final",
"K",
"key",
")",
"{",
"final",
"ValueSubscriber",
"<",
"V",
">",
"sub",
"=",
"ValueSubscriber",
".",
"subscriber... | Extract one value from the selected pipe, if it exists
@param key : Adapter identifier
@return Maybe containing next value from the Adapter identified by the provided key | [
"Extract",
"one",
"value",
"from",
"the",
"selected",
"pipe",
"if",
"it",
"exists"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/cyclops/futurestream/Pipes.java#L276-L282 |
48,117 | aol/cyclops | cyclops-futurestream/src/main/java/cyclops/futurestream/Pipes.java | Pipes.subscribeTo | public void subscribeTo(final K key, final Subscriber<V> subscriber) {
registered.get(key)
.stream()
.subscribe(subscriber);
} | java | public void subscribeTo(final K key, final Subscriber<V> subscriber) {
registered.get(key)
.stream()
.subscribe(subscriber);
} | [
"public",
"void",
"subscribeTo",
"(",
"final",
"K",
"key",
",",
"final",
"Subscriber",
"<",
"V",
">",
"subscriber",
")",
"{",
"registered",
".",
"get",
"(",
"key",
")",
".",
"stream",
"(",
")",
".",
"subscribe",
"(",
"subscriber",
")",
";",
"}"
] | Subscribe synchronously to a pipe
@param key for registered simple-react async.Adapter
@param subscriber Reactive Streams reactiveSubscriber for data on this pipe | [
"Subscribe",
"synchronously",
"to",
"a",
"pipe"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/cyclops/futurestream/Pipes.java#L544-L549 |
48,118 | aol/cyclops | cyclops-futurestream/src/main/java/cyclops/futurestream/Pipes.java | Pipes.subscribeTo | public void subscribeTo(final K key, final Subscriber<V> subscriber, final Executor subscribeOn) {
CompletableFuture.runAsync(() -> subscribeTo(key, subscriber), subscribeOn);
} | java | public void subscribeTo(final K key, final Subscriber<V> subscriber, final Executor subscribeOn) {
CompletableFuture.runAsync(() -> subscribeTo(key, subscriber), subscribeOn);
} | [
"public",
"void",
"subscribeTo",
"(",
"final",
"K",
"key",
",",
"final",
"Subscriber",
"<",
"V",
">",
"subscriber",
",",
"final",
"Executor",
"subscribeOn",
")",
"{",
"CompletableFuture",
".",
"runAsync",
"(",
"(",
")",
"->",
"subscribeTo",
"(",
"key",
","... | Subscribe asynchronously to a pipe
<pre>
{@code
SeqSubscriber<String> reactiveSubscriber = SeqSubscriber.reactiveSubscriber();
Queue<String> queue = new Queue();
pipes.register("hello", queue);
pipes.subscribeTo("hello",reactiveSubscriber,ForkJoinPool.commonPool());
queue.offer("world");
queue.close();
assertThat(rea... | [
"Subscribe",
"asynchronously",
"to",
"a",
"pipe"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/cyclops/futurestream/Pipes.java#L573-L576 |
48,119 | aol/cyclops | cyclops-futurestream/src/main/java/cyclops/futurestream/Pipes.java | Pipes.publishTo | public void publishTo(final K key, final Publisher<V> publisher) {
registered.get(key).fromStream(Spouts.from(publisher));
} | java | public void publishTo(final K key, final Publisher<V> publisher) {
registered.get(key).fromStream(Spouts.from(publisher));
} | [
"public",
"void",
"publishTo",
"(",
"final",
"K",
"key",
",",
"final",
"Publisher",
"<",
"V",
">",
"publisher",
")",
"{",
"registered",
".",
"get",
"(",
"key",
")",
".",
"fromStream",
"(",
"Spouts",
".",
"from",
"(",
"publisher",
")",
")",
";",
"}"
] | Synchronously publish data to the Adapter specified by the provided Key, blocking the current thread
@param key for registered cylops-react async.Adapter
@param publisher Reactive Streams publisher to push data onto this pipe | [
"Synchronously",
"publish",
"data",
"to",
"the",
"Adapter",
"specified",
"by",
"the",
"provided",
"Key",
"blocking",
"the",
"current",
"thread"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/cyclops/futurestream/Pipes.java#L584-L586 |
48,120 | aol/cyclops | cyclops-futurestream/src/main/java/cyclops/futurestream/Pipes.java | Pipes.publishToAsync | public void publishToAsync(final K key, final Publisher<V> publisher) {
SequentialElasticPools.simpleReact.react(er -> er.of(publisher)
.peek(p -> publishTo(key, p)));
} | java | public void publishToAsync(final K key, final Publisher<V> publisher) {
SequentialElasticPools.simpleReact.react(er -> er.of(publisher)
.peek(p -> publishTo(key, p)));
} | [
"public",
"void",
"publishToAsync",
"(",
"final",
"K",
"key",
",",
"final",
"Publisher",
"<",
"V",
">",
"publisher",
")",
"{",
"SequentialElasticPools",
".",
"simpleReact",
".",
"react",
"(",
"er",
"->",
"er",
".",
"of",
"(",
"publisher",
")",
".",
"peek... | Asynchronously publish data to the Adapter specified by the provided Key
<pre>
{@code
Pipes<String,Integer> pipes = Pipes.of();
Queue<Integer> queue = new Queue();
pipes.register("hello", queue);
pipes.publishToAsync("hello",ReactiveSeq.of(1,2,3));
Thread.sleep(100);
queue.offer(4);
queue.close();
assertThat(queue.... | [
"Asynchronously",
"publish",
"data",
"to",
"the",
"Adapter",
"specified",
"by",
"the",
"provided",
"Key"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/cyclops/futurestream/Pipes.java#L613-L616 |
48,121 | aol/cyclops | cyclops-futurestream/src/main/java/cyclops/futurestream/Pipes.java | Pipes.close | public void close(final String key) {
Optional.ofNullable(registered.get(key))
.ifPresent(a -> a.close());
} | java | public void close(final String key) {
Optional.ofNullable(registered.get(key))
.ifPresent(a -> a.close());
} | [
"public",
"void",
"close",
"(",
"final",
"String",
"key",
")",
"{",
"Optional",
".",
"ofNullable",
"(",
"registered",
".",
"get",
"(",
"key",
")",
")",
".",
"ifPresent",
"(",
"a",
"->",
"a",
".",
"close",
"(",
")",
")",
";",
"}"
] | Close the Adapter identified by the provided Key if it exists
@param key : Adapter identifier | [
"Close",
"the",
"Adapter",
"identified",
"by",
"the",
"provided",
"Key",
"if",
"it",
"exists"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/cyclops/futurestream/Pipes.java#L623-L627 |
48,122 | aol/cyclops | cyclops-futurestream/src/main/java/cyclops/futurestream/LazyReact.java | LazyReact.from | public <U> FutureStream<U> from(final CompletableFuture<U> cf) {
return this.constructFutures(Stream.of(cf));
} | java | public <U> FutureStream<U> from(final CompletableFuture<U> cf) {
return this.constructFutures(Stream.of(cf));
} | [
"public",
"<",
"U",
">",
"FutureStream",
"<",
"U",
">",
"from",
"(",
"final",
"CompletableFuture",
"<",
"U",
">",
"cf",
")",
"{",
"return",
"this",
".",
"constructFutures",
"(",
"Stream",
".",
"of",
"(",
"cf",
")",
")",
";",
"}"
] | Construct a FutureStream containing a single Future
@param cf CompletableFuture to create Stream from
@return FutureStream of a single value | [
"Construct",
"a",
"FutureStream",
"containing",
"a",
"single",
"Future"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/cyclops/futurestream/LazyReact.java#L224-L228 |
48,123 | aol/cyclops | cyclops-futurestream/src/main/java/cyclops/futurestream/LazyReact.java | LazyReact.constructFutures | public <U> FutureStream<U> constructFutures(final Stream<CompletableFuture<U>> s) {
final LazyReact toUse = withStreamOfFutures(true);
return toUse.construct((Stream<U>) s);
} | java | public <U> FutureStream<U> constructFutures(final Stream<CompletableFuture<U>> s) {
final LazyReact toUse = withStreamOfFutures(true);
return toUse.construct((Stream<U>) s);
} | [
"public",
"<",
"U",
">",
"FutureStream",
"<",
"U",
">",
"constructFutures",
"(",
"final",
"Stream",
"<",
"CompletableFuture",
"<",
"U",
">",
">",
"s",
")",
"{",
"final",
"LazyReact",
"toUse",
"=",
"withStreamOfFutures",
"(",
"true",
")",
";",
"return",
"... | Construct a FutureStream from a Stream of CompletableFutures
@param s Stream of CompletableFutures
@return FutureStream | [
"Construct",
"a",
"FutureStream",
"from",
"a",
"Stream",
"of",
"CompletableFutures"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/cyclops/futurestream/LazyReact.java#L276-L279 |
48,124 | aol/cyclops | cyclops-futurestream/src/main/java/cyclops/futurestream/LazyReact.java | LazyReact.fromPublisher | public <T> FutureStream<T> fromPublisher(final Publisher<? extends T> publisher) {
Objects.requireNonNull(publisher);
Publisher<T> narrowed = (Publisher<T>)publisher;
return fromStream(Spouts.from(narrowed));
} | java | public <T> FutureStream<T> fromPublisher(final Publisher<? extends T> publisher) {
Objects.requireNonNull(publisher);
Publisher<T> narrowed = (Publisher<T>)publisher;
return fromStream(Spouts.from(narrowed));
} | [
"public",
"<",
"T",
">",
"FutureStream",
"<",
"T",
">",
"fromPublisher",
"(",
"final",
"Publisher",
"<",
"?",
"extends",
"T",
">",
"publisher",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"publisher",
")",
";",
"Publisher",
"<",
"T",
">",
"narrowed"... | Construct a FutureStream from an Publisher
<pre>
{@code
new LazyReact().fromPublisher(Flux.just(1,2,3)).toList();
}
</pre>
@param publisher
to construct FutureStream from
@return FutureStream | [
"Construct",
"a",
"FutureStream",
"from",
"an",
"Publisher"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/cyclops/futurestream/LazyReact.java#L414-L418 |
48,125 | aol/cyclops | cyclops-futurestream/src/main/java/cyclops/futurestream/LazyReact.java | LazyReact.parallelBuilder | public static LazyReact parallelBuilder(final int parallelism) {
return LazyReact.builder()
.executor(Executors.newFixedThreadPool(parallelism))
.build();
} | java | public static LazyReact parallelBuilder(final int parallelism) {
return LazyReact.builder()
.executor(Executors.newFixedThreadPool(parallelism))
.build();
} | [
"public",
"static",
"LazyReact",
"parallelBuilder",
"(",
"final",
"int",
"parallelism",
")",
"{",
"return",
"LazyReact",
".",
"builder",
"(",
")",
".",
"executor",
"(",
"Executors",
".",
"newFixedThreadPool",
"(",
"parallelism",
")",
")",
".",
"build",
"(",
... | Construct a new LazyReact builder, with a new task executor and retry
executor with configured number of threads
@param parallelism
Number of threads task executor should have
@return LazyReact instance | [
"Construct",
"a",
"new",
"LazyReact",
"builder",
"with",
"a",
"new",
"task",
"executor",
"and",
"retry",
"executor",
"with",
"configured",
"number",
"of",
"threads"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/cyclops/futurestream/LazyReact.java#L729-L733 |
48,126 | aol/cyclops | cyclops-futurestream/src/main/java/cyclops/futurestream/LazyReact.java | LazyReact.iterate | public <U> FutureStream<U> iterate(final U seed, final UnaryOperator<U> f) {
final Subscription sub = new Subscription();
final Supplier<U> supplier = new Supplier<U>() {
@SuppressWarnings("unchecked")
U t = (U) NONE;
@Override
public U get() {
... | java | public <U> FutureStream<U> iterate(final U seed, final UnaryOperator<U> f) {
final Subscription sub = new Subscription();
final Supplier<U> supplier = new Supplier<U>() {
@SuppressWarnings("unchecked")
U t = (U) NONE;
@Override
public U get() {
... | [
"public",
"<",
"U",
">",
"FutureStream",
"<",
"U",
">",
"iterate",
"(",
"final",
"U",
"seed",
",",
"final",
"UnaryOperator",
"<",
"U",
">",
"f",
")",
"{",
"final",
"Subscription",
"sub",
"=",
"new",
"Subscription",
"(",
")",
";",
"final",
"Supplier",
... | Iterate infinitely using the supplied seed and function
Iteration is synchronized to support multiple threads using the same iterator.
<pre>
{@code
new LazyReact().objectPoolingOn()
.iterate(1,i->i+1)
.limit(1_000_000)
.map(this::process)
.forEach(this::save);
}
</pre>
@see FutureStream#iterate for an alternative w... | [
"Iterate",
"infinitely",
"using",
"the",
"supplied",
"seed",
"and",
"function",
"Iteration",
"is",
"synchronized",
"to",
"support",
"multiple",
"threads",
"using",
"the",
"same",
"iterator",
"."
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/cyclops/futurestream/LazyReact.java#L809-L825 |
48,127 | aol/cyclops | cyclops-futurestream/src/main/java/cyclops/futurestream/LazyReact.java | LazyReact.generate | public <U> FutureStream<U> generate(final Supplier<U> generate) {
return construct(StreamSupport.<U> stream(new InfiniteClosingSpliteratorFromSupplier<U>(
Long.MAX_VALUE, generate, new Subscription()),
... | java | public <U> FutureStream<U> generate(final Supplier<U> generate) {
return construct(StreamSupport.<U> stream(new InfiniteClosingSpliteratorFromSupplier<U>(
Long.MAX_VALUE, generate, new Subscription()),
... | [
"public",
"<",
"U",
">",
"FutureStream",
"<",
"U",
">",
"generate",
"(",
"final",
"Supplier",
"<",
"U",
">",
"generate",
")",
"{",
"return",
"construct",
"(",
"StreamSupport",
".",
"<",
"U",
">",
"stream",
"(",
"new",
"InfiniteClosingSpliteratorFromSupplier"... | Generate an infinite Stream
<pre>
{@code
new LazyReact().generate(()->"hello")
.limit(5)
.reduce(SemigroupK.stringConcat);
Optional[hellohellohellohellohello]
}</pre>
@param generate Supplier that generates stream input
@return Infinite FutureStream | [
"Generate",
"an",
"infinite",
"Stream"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/cyclops/futurestream/LazyReact.java#L876-L881 |
48,128 | aol/cyclops | cyclops-futurestream/src/main/java/cyclops/futurestream/LazyReact.java | LazyReact.generateAsync | public <U> FutureStream<U> generateAsync(final Supplier<U> s) {
return this.constructFutures(ReactiveSeq.generate(() -> 1)
.map(n -> CompletableFuture.supplyAsync(s, getExecutor())));
} | java | public <U> FutureStream<U> generateAsync(final Supplier<U> s) {
return this.constructFutures(ReactiveSeq.generate(() -> 1)
.map(n -> CompletableFuture.supplyAsync(s, getExecutor())));
} | [
"public",
"<",
"U",
">",
"FutureStream",
"<",
"U",
">",
"generateAsync",
"(",
"final",
"Supplier",
"<",
"U",
">",
"s",
")",
"{",
"return",
"this",
".",
"constructFutures",
"(",
"ReactiveSeq",
".",
"generate",
"(",
"(",
")",
"->",
"1",
")",
".",
"map"... | Generate an infinite FutureStream executing the provided Supplier continually and asynhcronously
<pre>
{@code
new LazyReact().generate(this::load)
.limit(5)
.reduce(SemigroupK.stringConcat);
Optional["data1data2data3data4data5"]
}</pre>
@param s Supplier to execute asynchronously to create an infinite Stream
@return... | [
"Generate",
"an",
"infinite",
"FutureStream",
"executing",
"the",
"provided",
"Supplier",
"continually",
"and",
"asynhcronously"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/cyclops/futurestream/LazyReact.java#L898-L902 |
48,129 | aol/cyclops | cyclops/src/main/java/com/oath/cyclops/async/adapters/Signal.java | Signal.set | public T set(final T newValue) {
if(continuous!=null)
continuous.offer(newValue);
setDiscreteIfDiff(newValue);
return newValue;
} | java | public T set(final T newValue) {
if(continuous!=null)
continuous.offer(newValue);
setDiscreteIfDiff(newValue);
return newValue;
} | [
"public",
"T",
"set",
"(",
"final",
"T",
"newValue",
")",
"{",
"if",
"(",
"continuous",
"!=",
"null",
")",
"continuous",
".",
"offer",
"(",
"newValue",
")",
";",
"setDiscreteIfDiff",
"(",
"newValue",
")",
";",
"return",
"newValue",
";",
"}"
] | Set the current value of this signal
@param newValue Replacement value
@return newValue | [
"Set",
"the",
"current",
"value",
"of",
"this",
"signal"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/async/adapters/Signal.java#L76-L82 |
48,130 | aol/cyclops | cyclops/src/main/java/com/oath/cyclops/internal/stream/spliterators/push/Concat.java | Concat.addMissingRequests | public void addMissingRequests(){
int missed=1;
long toRequest=0L;
do {
long localQueued = queued.getAndSet(0l);
Subscription localSub = next.getAndSet(null);
long missedOutput = produced.get();
Subscription localActive = active.get();
... | java | public void addMissingRequests(){
int missed=1;
long toRequest=0L;
do {
long localQueued = queued.getAndSet(0l);
Subscription localSub = next.getAndSet(null);
long missedOutput = produced.get();
Subscription localActive = active.get();
... | [
"public",
"void",
"addMissingRequests",
"(",
")",
"{",
"int",
"missed",
"=",
"1",
";",
"long",
"toRequest",
"=",
"0L",
";",
"do",
"{",
"long",
"localQueued",
"=",
"queued",
".",
"getAndSet",
"(",
"0l",
")",
";",
"Subscription",
"localSub",
"=",
"next",
... | transfer demand from previous to next | [
"transfer",
"demand",
"from",
"previous",
"to",
"next"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/internal/stream/spliterators/push/Concat.java#L97-L136 |
48,131 | aol/cyclops | cyclops/src/main/java/com/oath/cyclops/types/reactive/ReactiveTask.java | ReactiveTask.requestAsync | public ReactiveTask requestAsync(final long n) {
return withSubscriptionAndTask(subscriptionAndTask.map2(c -> CompletableFuture.runAsync(() -> subscriptionAndTask._1().join()
.request(n),
... | java | public ReactiveTask requestAsync(final long n) {
return withSubscriptionAndTask(subscriptionAndTask.map2(c -> CompletableFuture.runAsync(() -> subscriptionAndTask._1().join()
.request(n),
... | [
"public",
"ReactiveTask",
"requestAsync",
"(",
"final",
"long",
"n",
")",
"{",
"return",
"withSubscriptionAndTask",
"(",
"subscriptionAndTask",
".",
"map2",
"(",
"c",
"->",
"CompletableFuture",
".",
"runAsync",
"(",
"(",
")",
"->",
"subscriptionAndTask",
".",
"_... | Asyncrhonously request more elements from the Stream
@param n Number of elements to request
@return New ReactiveTask that references the execution of the new async task | [
"Asyncrhonously",
"request",
"more",
"elements",
"from",
"the",
"Stream"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/types/reactive/ReactiveTask.java#L63-L67 |
48,132 | aol/cyclops | cyclops-anym/src/main/java/cyclops/monads/transformers/EitherT.java | EitherT.map | @Override
public <B> EitherT<W,ST,B> map(final Function<? super T, ? extends B> f) {
return new EitherT<W,ST,B>(
run.map(o -> o.map(f)));
} | java | @Override
public <B> EitherT<W,ST,B> map(final Function<? super T, ? extends B> f) {
return new EitherT<W,ST,B>(
run.map(o -> o.map(f)));
} | [
"@",
"Override",
"public",
"<",
"B",
">",
"EitherT",
"<",
"W",
",",
"ST",
",",
"B",
">",
"map",
"(",
"final",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"B",
">",
"f",
")",
"{",
"return",
"new",
"EitherT",
"<",
"W",
",",
"ST",
"... | Map the wrapped Maybe
<pre>
{@code
MaybeWT.of(AnyM.fromStream(Arrays.asMaybeW(10))
.map(t->t=t+1);
//MaybeWT<AnyMSeq<Stream<Maybe[11]>>>
}
</pre>
@param f Mapping function for the wrapped Maybe
@return MaybeWT that applies the transform function to the wrapped Maybe | [
"Map",
"the",
"wrapped",
"Maybe"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-anym/src/main/java/cyclops/monads/transformers/EitherT.java#L119-L123 |
48,133 | aol/cyclops | cyclops-anym/src/main/java/cyclops/monads/transformers/EitherT.java | EitherT.lift | public static <W extends WitnessType<W>,U,ST, R> Function<EitherT<W,ST,U>, EitherT<W,ST,R>> lift(final Function<? super U, ? extends R> fn) {
return optTu -> optTu.map(input -> fn.apply(input));
} | java | public static <W extends WitnessType<W>,U,ST, R> Function<EitherT<W,ST,U>, EitherT<W,ST,R>> lift(final Function<? super U, ? extends R> fn) {
return optTu -> optTu.map(input -> fn.apply(input));
} | [
"public",
"static",
"<",
"W",
"extends",
"WitnessType",
"<",
"W",
">",
",",
"U",
",",
"ST",
",",
"R",
">",
"Function",
"<",
"EitherT",
"<",
"W",
",",
"ST",
",",
"U",
">",
",",
"EitherT",
"<",
"W",
",",
"ST",
",",
"R",
">",
">",
"lift",
"(",
... | Lift a function into one that accepts and returns an MaybeWT
This allows multiple monad types to add functionality to existing function and methods
e.g. to add list handling / iteration (via Maybe) and iteration (via Stream) to an existing function
<pre>
{@code
Function<Integer,Integer> add2 = i -> i+2;
Function<Mayb... | [
"Lift",
"a",
"function",
"into",
"one",
"that",
"accepts",
"and",
"returns",
"an",
"MaybeWT",
"This",
"allows",
"multiple",
"monad",
"types",
"to",
"add",
"functionality",
"to",
"existing",
"function",
"and",
"methods"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-anym/src/main/java/cyclops/monads/transformers/EitherT.java#L187-L189 |
48,134 | aol/cyclops | cyclops-anym/src/main/java/cyclops/monads/transformers/EitherT.java | EitherT.of | public static <W extends WitnessType<W>,ST,A> EitherT<W,ST,A> of(final AnyM<W,Either<ST,A>> monads) {
return new EitherT<>(
monads);
} | java | public static <W extends WitnessType<W>,ST,A> EitherT<W,ST,A> of(final AnyM<W,Either<ST,A>> monads) {
return new EitherT<>(
monads);
} | [
"public",
"static",
"<",
"W",
"extends",
"WitnessType",
"<",
"W",
">",
",",
"ST",
",",
"A",
">",
"EitherT",
"<",
"W",
",",
"ST",
",",
"A",
">",
"of",
"(",
"final",
"AnyM",
"<",
"W",
",",
"Either",
"<",
"ST",
",",
"A",
">",
">",
"monads",
")",... | Construct an MaybeWT from an AnyM that wraps a monad containing MaybeWs
@param monads AnyM that contains a monad wrapping an Maybe
@return MaybeWT | [
"Construct",
"an",
"MaybeWT",
"from",
"an",
"AnyM",
"that",
"wraps",
"a",
"monad",
"containing",
"MaybeWs"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-anym/src/main/java/cyclops/monads/transformers/EitherT.java#L243-L246 |
48,135 | aol/cyclops | cyclops-anym/src/main/java/cyclops/monads/transformers/EvalT.java | EvalT.of | public static <W extends WitnessType<W>,A> EvalT<W,A> of(final AnyM<W,Eval<A>> monads) {
return new EvalT<>(
monads);
} | java | public static <W extends WitnessType<W>,A> EvalT<W,A> of(final AnyM<W,Eval<A>> monads) {
return new EvalT<>(
monads);
} | [
"public",
"static",
"<",
"W",
"extends",
"WitnessType",
"<",
"W",
">",
",",
"A",
">",
"EvalT",
"<",
"W",
",",
"A",
">",
"of",
"(",
"final",
"AnyM",
"<",
"W",
",",
"Eval",
"<",
"A",
">",
">",
"monads",
")",
"{",
"return",
"new",
"EvalT",
"<>",
... | Construct an EvalWT from an AnyM that wraps a monad containing EvalWs
@param monads AnyM that contains a monad wrapping an Eval
@return EvalWT | [
"Construct",
"an",
"EvalWT",
"from",
"an",
"AnyM",
"that",
"wraps",
"a",
"monad",
"containing",
"EvalWs"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-anym/src/main/java/cyclops/monads/transformers/EvalT.java#L250-L253 |
48,136 | aol/cyclops | cyclops/src/main/java/com/oath/cyclops/async/adapters/Queue.java | Queue.add | public boolean add(final T data) {
try {
final boolean result = queue.add((T) nullSafe(data));
if (result) {
if (sizeSignal != null)
this.sizeSignal.set(queue.size());
}
return result;
} catch (final IllegalStateExcep... | java | public boolean add(final T data) {
try {
final boolean result = queue.add((T) nullSafe(data));
if (result) {
if (sizeSignal != null)
this.sizeSignal.set(queue.size());
}
return result;
} catch (final IllegalStateExcep... | [
"public",
"boolean",
"add",
"(",
"final",
"T",
"data",
")",
"{",
"try",
"{",
"final",
"boolean",
"result",
"=",
"queue",
".",
"add",
"(",
"(",
"T",
")",
"nullSafe",
"(",
"data",
")",
")",
";",
"if",
"(",
"result",
")",
"{",
"if",
"(",
"sizeSignal... | Add a single data point to the queue
If the queue is a bounded queue and is full, will return false
@param data Data to add
@return true if successfully added. | [
"Add",
"a",
"single",
"data",
"point",
"to",
"the",
"queue"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/async/adapters/Queue.java#L530-L544 |
48,137 | aol/cyclops | cyclops/src/main/java/com/oath/cyclops/async/adapters/Queue.java | Queue.offer | @Override
public boolean offer(final T data) {
if (!open) {
throw new ClosedQueueException();
}
try {
final boolean result = producerWait.offer(() -> this.queue.offer((T) nullSafe(data), this.offerTimeout, this.offerTimeUnit));
if (sizeSignal != null)
... | java | @Override
public boolean offer(final T data) {
if (!open) {
throw new ClosedQueueException();
}
try {
final boolean result = producerWait.offer(() -> this.queue.offer((T) nullSafe(data), this.offerTimeout, this.offerTimeUnit));
if (sizeSignal != null)
... | [
"@",
"Override",
"public",
"boolean",
"offer",
"(",
"final",
"T",
"data",
")",
"{",
"if",
"(",
"!",
"open",
")",
"{",
"throw",
"new",
"ClosedQueueException",
"(",
")",
";",
"}",
"try",
"{",
"final",
"boolean",
"result",
"=",
"producerWait",
".",
"offer... | Offer a single datapoint to this Queue
If the queue is a bounded queue and is full it will block until space comes available or until
offer time out is reached (default is Integer.MAX_VALUE DAYS).
@param data
data to add
@return self | [
"Offer",
"a",
"single",
"datapoint",
"to",
"this",
"Queue"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/async/adapters/Queue.java#L571-L590 |
48,138 | aol/cyclops | cyclops/src/main/java/com/oath/cyclops/async/adapters/Queue.java | Queue.close | @Override
public boolean close() {
this.open = false;
for (int i = 0; i < listeningStreams.get(); i++) {
try{
this.queue.offer((T) POISON_PILL);
}catch(Exception e){
}
}
return true;
} | java | @Override
public boolean close() {
this.open = false;
for (int i = 0; i < listeningStreams.get(); i++) {
try{
this.queue.offer((T) POISON_PILL);
}catch(Exception e){
}
}
return true;
} | [
"@",
"Override",
"public",
"boolean",
"close",
"(",
")",
"{",
"this",
".",
"open",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"listeningStreams",
".",
"get",
"(",
")",
";",
"i",
"++",
")",
"{",
"try",
"{",
"this",
".",
... | Close this Queue
Poison Pills are used to communicate closure to connected Streams
A Poison Pill is added per connected Stream to the Queue
If a BlockingQueue is backing this async.Queue it will block until
able to add to the Queue.
@return true if closed | [
"Close",
"this",
"Queue",
"Poison",
"Pills",
"are",
"used",
"to",
"communicate",
"closure",
"to",
"connected",
"Streams",
"A",
"Poison",
"Pill",
"is",
"added",
"per",
"connected",
"Stream",
"to",
"the",
"Queue",
"If",
"a",
"BlockingQueue",
"is",
"backing",
"... | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/async/adapters/Queue.java#L624-L638 |
48,139 | aol/cyclops | cyclops/src/main/java/com/oath/cyclops/util/box/LazyImmutable.java | LazyImmutable.map | @Override
public <R> LazyImmutable<R> map(final Function<? super T, ? extends R> fn) {
final T val = get();
if (val == UNSET)
return (LazyImmutable<R>) this;
else
return LazyImmutable.of(fn.apply(val));
} | java | @Override
public <R> LazyImmutable<R> map(final Function<? super T, ? extends R> fn) {
final T val = get();
if (val == UNSET)
return (LazyImmutable<R>) this;
else
return LazyImmutable.of(fn.apply(val));
} | [
"@",
"Override",
"public",
"<",
"R",
">",
"LazyImmutable",
"<",
"R",
">",
"map",
"(",
"final",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"R",
">",
"fn",
")",
"{",
"final",
"T",
"val",
"=",
"get",
"(",
")",
";",
"if",
"(",
"val",
... | Map the value stored in this Immutable Closed Value from one Value to another
If this is an unitiatilised ImmutableClosedValue, an uninitialised closed value will be returned instead
@param fn Mapper function
@return new ImmutableClosedValue with new mapped value | [
"Map",
"the",
"value",
"stored",
"in",
"this",
"Immutable",
"Closed",
"Value",
"from",
"one",
"Value",
"to",
"another",
"If",
"this",
"is",
"an",
"unitiatilised",
"ImmutableClosedValue",
"an",
"uninitialised",
"closed",
"value",
"will",
"be",
"returned",
"instea... | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/util/box/LazyImmutable.java#L95-L102 |
48,140 | aol/cyclops | cyclops/src/main/java/com/oath/cyclops/util/box/LazyImmutable.java | LazyImmutable.flatMap | public <R> LazyImmutable<? extends R> flatMap(final Function<? super T, ? extends LazyImmutable<? extends R>> fn) {
final T val = get();
if (val == UNSET)
return (LazyImmutable<R>) this;
else
return fn.apply(val);
} | java | public <R> LazyImmutable<? extends R> flatMap(final Function<? super T, ? extends LazyImmutable<? extends R>> fn) {
final T val = get();
if (val == UNSET)
return (LazyImmutable<R>) this;
else
return fn.apply(val);
} | [
"public",
"<",
"R",
">",
"LazyImmutable",
"<",
"?",
"extends",
"R",
">",
"flatMap",
"(",
"final",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"LazyImmutable",
"<",
"?",
"extends",
"R",
">",
">",
"fn",
")",
"{",
"final",
"T",
"val",
"="... | FlatMap the value stored in Immutable Closed Value from one Value to another
If this is an unitiatilised ImmutableClosedValue, an uninitialised closed value will be returned instead
@param fn Flat Mapper function
@return new ImmutableClosedValue with new mapped value | [
"FlatMap",
"the",
"value",
"stored",
"in",
"Immutable",
"Closed",
"Value",
"from",
"one",
"Value",
"to",
"another",
"If",
"this",
"is",
"an",
"unitiatilised",
"ImmutableClosedValue",
"an",
"uninitialised",
"closed",
"value",
"will",
"be",
"returned",
"instead"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/util/box/LazyImmutable.java#L113-L120 |
48,141 | aol/cyclops | cyclops/src/main/java/com/oath/cyclops/util/box/LazyImmutable.java | LazyImmutable.computeIfAbsent | public T computeIfAbsent(final Supplier<T> lazy) {
final T val = get();
if (val == UNSET)
return setOnceFromSupplier(lazy);
return val;
} | java | public T computeIfAbsent(final Supplier<T> lazy) {
final T val = get();
if (val == UNSET)
return setOnceFromSupplier(lazy);
return val;
} | [
"public",
"T",
"computeIfAbsent",
"(",
"final",
"Supplier",
"<",
"T",
">",
"lazy",
")",
"{",
"final",
"T",
"val",
"=",
"get",
"(",
")",
";",
"if",
"(",
"val",
"==",
"UNSET",
")",
"return",
"setOnceFromSupplier",
"(",
"lazy",
")",
";",
"return",
"val"... | Get the current value or set if it has not been set yet
@param lazy Supplier to generate new value
@return Current value | [
"Get",
"the",
"current",
"value",
"or",
"set",
"if",
"it",
"has",
"not",
"been",
"set",
"yet"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/util/box/LazyImmutable.java#L150-L157 |
48,142 | aol/cyclops | cyclops-futurestream/src/main/java/com/oath/cyclops/react/threads/ReactPool.java | ReactPool.elasticPool | public static <REACTOR extends ReactBuilder> ReactPool<REACTOR> elasticPool(final Supplier<REACTOR> supplier) {
return new ReactPool<>(
supplier);
} | java | public static <REACTOR extends ReactBuilder> ReactPool<REACTOR> elasticPool(final Supplier<REACTOR> supplier) {
return new ReactPool<>(
supplier);
} | [
"public",
"static",
"<",
"REACTOR",
"extends",
"ReactBuilder",
">",
"ReactPool",
"<",
"REACTOR",
">",
"elasticPool",
"(",
"final",
"Supplier",
"<",
"REACTOR",
">",
"supplier",
")",
"{",
"return",
"new",
"ReactPool",
"<>",
"(",
"supplier",
")",
";",
"}"
] | If all REACTORs are in use calling react will create a new REACTOR to handle the extra demand.
Generate an elastic pool of REACTORs
@param supplier To create new REACTORs
@return ReactPool | [
"If",
"all",
"REACTORs",
"are",
"in",
"use",
"calling",
"react",
"will",
"create",
"a",
"new",
"REACTOR",
"to",
"handle",
"the",
"extra",
"demand",
"."
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/com/oath/cyclops/react/threads/ReactPool.java#L83-L87 |
48,143 | aol/cyclops | cyclops-reactor-integration/src/main/java/cyclops/monads/transformers/reactor/MonoT.java | MonoT.flatMapT | public <B> MonoT<W,B> flatMapT(final Function<? super T, MonoT<W,B>> f) {
MonoT<W, B> r = of(run.map(future -> Mono.from(future.flatMap(a -> {
Mono<B> m = f.apply(a).run.stream()
.toList()
.get(0);
return m;
}))));
return r;
} | java | public <B> MonoT<W,B> flatMapT(final Function<? super T, MonoT<W,B>> f) {
MonoT<W, B> r = of(run.map(future -> Mono.from(future.flatMap(a -> {
Mono<B> m = f.apply(a).run.stream()
.toList()
.get(0);
return m;
}))));
return r;
} | [
"public",
"<",
"B",
">",
"MonoT",
"<",
"W",
",",
"B",
">",
"flatMapT",
"(",
"final",
"Function",
"<",
"?",
"super",
"T",
",",
"MonoT",
"<",
"W",
",",
"B",
">",
">",
"f",
")",
"{",
"MonoT",
"<",
"W",
",",
"B",
">",
"r",
"=",
"of",
"(",
"ru... | Flat Map the wrapped Mono
@param f FlatMap function
@return MonoT that applies the flatMap function to the wrapped Mono | [
"Flat",
"Map",
"the",
"wrapped",
"Mono"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-reactor-integration/src/main/java/cyclops/monads/transformers/reactor/MonoT.java#L143-L151 |
48,144 | aol/cyclops | cyclops-reactor-integration/src/main/java/cyclops/monads/transformers/reactor/MonoT.java | MonoT.of | public static <W extends WitnessType<W>,A> MonoT<W,A> of(final AnyM<W,Mono<A>> monads) {
return new MonoT<>(
monads);
} | java | public static <W extends WitnessType<W>,A> MonoT<W,A> of(final AnyM<W,Mono<A>> monads) {
return new MonoT<>(
monads);
} | [
"public",
"static",
"<",
"W",
"extends",
"WitnessType",
"<",
"W",
">",
",",
"A",
">",
"MonoT",
"<",
"W",
",",
"A",
">",
"of",
"(",
"final",
"AnyM",
"<",
"W",
",",
"Mono",
"<",
"A",
">",
">",
"monads",
")",
"{",
"return",
"new",
"MonoT",
"<>",
... | Construct an MonoT from an AnyM that wraps a monad containing MonoWs
@param monads AnyM that contains a monad wrapping an Mono
@return MonoT | [
"Construct",
"an",
"MonoT",
"from",
"an",
"AnyM",
"that",
"wraps",
"a",
"monad",
"containing",
"MonoWs"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-reactor-integration/src/main/java/cyclops/monads/transformers/reactor/MonoT.java#L187-L190 |
48,145 | aol/cyclops | cyclops/src/main/java/com/oath/cyclops/util/box/MutableInt.java | MutableInt.fromExternal | public static MutableInt fromExternal(final IntSupplier s, final IntConsumer c) {
return new MutableInt() {
@Override
public int getAsInt() {
return s.getAsInt();
}
@Override
public Integer get() {
return getAsInt();
... | java | public static MutableInt fromExternal(final IntSupplier s, final IntConsumer c) {
return new MutableInt() {
@Override
public int getAsInt() {
return s.getAsInt();
}
@Override
public Integer get() {
return getAsInt();
... | [
"public",
"static",
"MutableInt",
"fromExternal",
"(",
"final",
"IntSupplier",
"s",
",",
"final",
"IntConsumer",
"c",
")",
"{",
"return",
"new",
"MutableInt",
"(",
")",
"{",
"@",
"Override",
"public",
"int",
"getAsInt",
"(",
")",
"{",
"return",
"s",
".",
... | Construct a MutableInt that gets and sets an external value using the provided Supplier and Consumer
e.g.
<pre>
{@code
MutableInt mutable = MutableInt.fromExternal(()->!this.value,val->!this.value);
}
</pre>
@param s Supplier of an external value
@param c Consumer that sets an external value
@return MutableInt that ... | [
"Construct",
"a",
"MutableInt",
"that",
"gets",
"and",
"sets",
"an",
"external",
"value",
"using",
"the",
"provided",
"Supplier",
"and",
"Consumer"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/util/box/MutableInt.java#L80-L98 |
48,146 | aol/cyclops | cyclops/src/main/java/com/oath/cyclops/util/box/MutableByte.java | MutableByte.fromExternal | public static MutableByte fromExternal(final Supplier<Byte> s, final Consumer<Byte> c) {
return new MutableByte() {
@Override
public byte getAsByte() {
return s.get();
}
@Override
public Byte get() {
return getAsByte();... | java | public static MutableByte fromExternal(final Supplier<Byte> s, final Consumer<Byte> c) {
return new MutableByte() {
@Override
public byte getAsByte() {
return s.get();
}
@Override
public Byte get() {
return getAsByte();... | [
"public",
"static",
"MutableByte",
"fromExternal",
"(",
"final",
"Supplier",
"<",
"Byte",
">",
"s",
",",
"final",
"Consumer",
"<",
"Byte",
">",
"c",
")",
"{",
"return",
"new",
"MutableByte",
"(",
")",
"{",
"@",
"Override",
"public",
"byte",
"getAsByte",
... | Construct a MutableByte that gets and sets an external value using the provided Supplier and Consumer
e.g.
<pre>
{@code
MutableByte mutable = MutableByte.fromExternal(()->!this.value,val->!this.value);
}
</pre>
@param s Supplier of an external value
@param c Consumer that sets an external value
@return MutableByte t... | [
"Construct",
"a",
"MutableByte",
"that",
"gets",
"and",
"sets",
"an",
"external",
"value",
"using",
"the",
"provided",
"Supplier",
"and",
"Consumer"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/util/box/MutableByte.java#L81-L99 |
48,147 | aol/cyclops | cyclops/src/main/java/cyclops/function/Predicates.java | Predicates.any | public static final <Y> Predicate<Y> any(final Class<Y> c) {
return a -> a.getClass()
.isAssignableFrom(c);
} | java | public static final <Y> Predicate<Y> any(final Class<Y> c) {
return a -> a.getClass()
.isAssignableFrom(c);
} | [
"public",
"static",
"final",
"<",
"Y",
">",
"Predicate",
"<",
"Y",
">",
"any",
"(",
"final",
"Class",
"<",
"Y",
">",
"c",
")",
"{",
"return",
"a",
"->",
"a",
".",
"getClass",
"(",
")",
".",
"isAssignableFrom",
"(",
"c",
")",
";",
"}"
] | MatchType against any object that is an instance of supplied type
<pre>
{@code
import static com.oath.cyclops.control.Matchable.whenGuard;
import static com.oath.cyclops.control.Matchable.otherwise;
import static com.oath.cyclops.control.Matchable.transform;
import static cyclops2.function.Predicates.eq;
import static... | [
"MatchType",
"against",
"any",
"object",
"that",
"is",
"an",
"instance",
"of",
"supplied",
"type"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/function/Predicates.java#L247-L250 |
48,148 | aol/cyclops | cyclops-pure/src/main/java/cyclops/control/State.java | State.forEach2 | public <R1, R4> State<S,R4> forEach2(Function<? super T, State<S,R1>> value2,
BiFunction<? super T, ? super R1, ? extends R4> yieldingFunction) {
return this.flatMap(in -> {
State<S,R1> a = value2.apply(in);
return a.map(in2 -> {
... | java | public <R1, R4> State<S,R4> forEach2(Function<? super T, State<S,R1>> value2,
BiFunction<? super T, ? super R1, ? extends R4> yieldingFunction) {
return this.flatMap(in -> {
State<S,R1> a = value2.apply(in);
return a.map(in2 -> {
... | [
"public",
"<",
"R1",
",",
"R4",
">",
"State",
"<",
"S",
",",
"R4",
">",
"forEach2",
"(",
"Function",
"<",
"?",
"super",
"T",
",",
"State",
"<",
"S",
",",
"R1",
">",
">",
"value2",
",",
"BiFunction",
"<",
"?",
"super",
"T",
",",
"?",
"super",
... | Perform a For Comprehension over a State, accepting a generating function.
This results in a two level nested internal iteration over the provided States.
<pre>
{@code
import static com.oath.cyclops.reactor.States.forEach;
forEach(State.just(1),
a-> State.just(a+1),
Tuple::tuple)
}
</pre>
@param value2 Nested Stat... | [
"Perform",
"a",
"For",
"Comprehension",
"over",
"a",
"State",
"accepting",
"a",
"generating",
"function",
".",
"This",
"results",
"in",
"a",
"two",
"level",
"nested",
"internal",
"iteration",
"over",
"the",
"provided",
"States",
"."
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-pure/src/main/java/cyclops/control/State.java#L185-L198 |
48,149 | aol/cyclops | cyclops-futurestream/src/main/java/com/oath/cyclops/internal/react/async/future/FastFuture.java | FastFuture.join | public T join() {
try {
long spin = 1;
while (!done) {
LockSupport.parkNanos(spin++);
}
if (completedExceptionally)
throw new SimpleReactCompletionException(
exception());
... | java | public T join() {
try {
long spin = 1;
while (!done) {
LockSupport.parkNanos(spin++);
}
if (completedExceptionally)
throw new SimpleReactCompletionException(
exception());
... | [
"public",
"T",
"join",
"(",
")",
"{",
"try",
"{",
"long",
"spin",
"=",
"1",
";",
"while",
"(",
"!",
"done",
")",
"{",
"LockSupport",
".",
"parkNanos",
"(",
"spin",
"++",
")",
";",
"}",
"if",
"(",
"completedExceptionally",
")",
"throw",
"new",
"Simp... | Join which can be called exactly once!
@return Result | [
"Join",
"which",
"can",
"be",
"called",
"exactly",
"once!"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/com/oath/cyclops/internal/react/async/future/FastFuture.java#L104-L118 |
48,150 | aol/cyclops | cyclops-futurestream/src/main/java/com/oath/cyclops/internal/react/async/future/FastFuture.java | FastFuture.fromCompletableFuture | public static <T> FastFuture<T> fromCompletableFuture(final CompletableFuture<T> cf) {
final FastFuture<T> f = new FastFuture<>();
cf.thenAccept(i -> f.set(i));
cf.exceptionally(t -> {
f.completedExceptionally(t);
return f.join();
});
return f;
} | java | public static <T> FastFuture<T> fromCompletableFuture(final CompletableFuture<T> cf) {
final FastFuture<T> f = new FastFuture<>();
cf.thenAccept(i -> f.set(i));
cf.exceptionally(t -> {
f.completedExceptionally(t);
return f.join();
});
return f;
} | [
"public",
"static",
"<",
"T",
">",
"FastFuture",
"<",
"T",
">",
"fromCompletableFuture",
"(",
"final",
"CompletableFuture",
"<",
"T",
">",
"cf",
")",
"{",
"final",
"FastFuture",
"<",
"T",
">",
"f",
"=",
"new",
"FastFuture",
"<>",
"(",
")",
";",
"cf",
... | Internal conversion method to convert CompletableFutures to FastFuture. | [
"Internal",
"conversion",
"method",
"to",
"convert",
"CompletableFutures",
"to",
"FastFuture",
"."
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/com/oath/cyclops/internal/react/async/future/FastFuture.java#L191-L200 |
48,151 | aol/cyclops | cyclops-futurestream/src/main/java/com/oath/cyclops/types/futurestream/EagerFutureStreamFunctions.java | EagerFutureStreamFunctions.closeOthers | static void closeOthers(final Queue active, final List<Queue> all) {
all.stream()
.filter(next -> next != active)
.forEach(Queue::closeAndClear);
} | java | static void closeOthers(final Queue active, final List<Queue> all) {
all.stream()
.filter(next -> next != active)
.forEach(Queue::closeAndClear);
} | [
"static",
"void",
"closeOthers",
"(",
"final",
"Queue",
"active",
",",
"final",
"List",
"<",
"Queue",
">",
"all",
")",
"{",
"all",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"next",
"->",
"next",
"!=",
"active",
")",
".",
"forEach",
"(",
"Queue",
... | Close all queues except the active one
@param active Queue not to close
@param all All queues potentially including the active queue | [
"Close",
"all",
"queues",
"except",
"the",
"active",
"one"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/com/oath/cyclops/types/futurestream/EagerFutureStreamFunctions.java#L24-L29 |
48,152 | aol/cyclops | cyclops-futurestream/src/main/java/com/oath/cyclops/types/futurestream/EagerFutureStreamFunctions.java | EagerFutureStreamFunctions.closeOthers | static void closeOthers(final SimpleReactStream active, final List<SimpleReactStream> all) {
all.stream()
.filter(next -> next != active)
.filter(s -> s instanceof BaseSimpleReactStream)
.forEach(SimpleReactStream::cancel);
} | java | static void closeOthers(final SimpleReactStream active, final List<SimpleReactStream> all) {
all.stream()
.filter(next -> next != active)
.filter(s -> s instanceof BaseSimpleReactStream)
.forEach(SimpleReactStream::cancel);
} | [
"static",
"void",
"closeOthers",
"(",
"final",
"SimpleReactStream",
"active",
",",
"final",
"List",
"<",
"SimpleReactStream",
">",
"all",
")",
"{",
"all",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"next",
"->",
"next",
"!=",
"active",
")",
".",
"filte... | Close all streams except the active one
@param active Stream not to close
@param all All streams potentially including the active stream | [
"Close",
"all",
"streams",
"except",
"the",
"active",
"one"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/com/oath/cyclops/types/futurestream/EagerFutureStreamFunctions.java#L37-L43 |
48,153 | aol/cyclops | cyclops-futurestream/src/main/java/com/oath/cyclops/types/futurestream/EagerFutureStreamFunctions.java | EagerFutureStreamFunctions.firstOf | @SafeVarargs
public static <U> SimpleReactStream<U> firstOf(final SimpleReactStream<U>... futureStreams) {
final List<Tuple2<SimpleReactStream<U>, QueueReader>> racers = Stream.of(futureStreams)
.map(s -> Tuple.tuple(s, new Queue.Q... | java | @SafeVarargs
public static <U> SimpleReactStream<U> firstOf(final SimpleReactStream<U>... futureStreams) {
final List<Tuple2<SimpleReactStream<U>, QueueReader>> racers = Stream.of(futureStreams)
.map(s -> Tuple.tuple(s, new Queue.Q... | [
"@",
"SafeVarargs",
"public",
"static",
"<",
"U",
">",
"SimpleReactStream",
"<",
"U",
">",
"firstOf",
"(",
"final",
"SimpleReactStream",
"<",
"U",
">",
"...",
"futureStreams",
")",
"{",
"final",
"List",
"<",
"Tuple2",
"<",
"SimpleReactStream",
"<",
"U",
">... | Return first Stream out of provided Streams that starts emitted results
@param futureStreams Streams to race
@return First Stream to skip emitting values | [
"Return",
"first",
"Stream",
"out",
"of",
"provided",
"Streams",
"that",
"starts",
"emitted",
"results"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/com/oath/cyclops/types/futurestream/EagerFutureStreamFunctions.java#L59-L82 |
48,154 | aol/cyclops | cyclops-futurestream/src/main/java/cyclops/stream/StreamSource.java | StreamSource.ofMultiple | public static <T> MultipleStreamSource<T> ofMultiple(final QueueFactory<?> q) {
Objects.requireNonNull(q);
return new MultipleStreamSource<T>(
StreamSource.of(q)
.createQueue());
} | java | public static <T> MultipleStreamSource<T> ofMultiple(final QueueFactory<?> q) {
Objects.requireNonNull(q);
return new MultipleStreamSource<T>(
StreamSource.of(q)
.createQueue());
} | [
"public",
"static",
"<",
"T",
">",
"MultipleStreamSource",
"<",
"T",
">",
"ofMultiple",
"(",
"final",
"QueueFactory",
"<",
"?",
">",
"q",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"q",
")",
";",
"return",
"new",
"MultipleStreamSource",
"<",
"T",
"... | Construct a StreamSource that supports multiple readers of the same data backed by a Queue created
from the supplied QueueFactory
@see QueueFactories for Factory creation options and various backpressure strategies
<pre>
{@code
MultipleStreamSource<Integer> multi = StreamSource
.ofMultiple(QueueFactories.boundedQueue... | [
"Construct",
"a",
"StreamSource",
"that",
"supports",
"multiple",
"readers",
"of",
"the",
"same",
"data",
"backed",
"by",
"a",
"Queue",
"created",
"from",
"the",
"supplied",
"QueueFactory"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/cyclops/stream/StreamSource.java#L281-L286 |
48,155 | aol/cyclops | cyclops-futurestream/src/main/java/cyclops/stream/StreamSource.java | StreamSource.futureStream | public <T> PushableFutureStream<T> futureStream(final LazyReact s) {
final Queue<T> q = createQueue();
return new PushableFutureStream<T>(
q, s.fromStream(q.stream()));
} | java | public <T> PushableFutureStream<T> futureStream(final LazyReact s) {
final Queue<T> q = createQueue();
return new PushableFutureStream<T>(
q, s.fromStream(q.stream()));
} | [
"public",
"<",
"T",
">",
"PushableFutureStream",
"<",
"T",
">",
"futureStream",
"(",
"final",
"LazyReact",
"s",
")",
"{",
"final",
"Queue",
"<",
"T",
">",
"q",
"=",
"createQueue",
"(",
")",
";",
"return",
"new",
"PushableFutureStream",
"<",
"T",
">",
"... | Create a pushable FutureStream using the supplied ReactPool
<pre>
{@code
PushableFutureStream<Integer> pushable = StreamSource.ofUnbounded()
.futureStream(new LazyReact());
pushable.getInput().add(100);
pushable.getInput().close();
assertThat(pushable.getStream().collect(CyclopsCollectors.toList()),
hasItem(100));
... | [
"Create",
"a",
"pushable",
"FutureStream",
"using",
"the",
"supplied",
"ReactPool"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/cyclops/stream/StreamSource.java#L438-L444 |
48,156 | aol/cyclops | cyclops-futurestream/src/main/java/cyclops/stream/StreamSource.java | StreamSource.stream | public <T> PushableStream<T> stream() {
final Queue<T> q = createQueue();
return new PushableStream<T>(
q, q.jdkStream());
} | java | public <T> PushableStream<T> stream() {
final Queue<T> q = createQueue();
return new PushableStream<T>(
q, q.jdkStream());
} | [
"public",
"<",
"T",
">",
"PushableStream",
"<",
"T",
">",
"stream",
"(",
")",
"{",
"final",
"Queue",
"<",
"T",
">",
"q",
"=",
"createQueue",
"(",
")",
";",
"return",
"new",
"PushableStream",
"<",
"T",
">",
"(",
"q",
",",
"q",
".",
"jdkStream",
"(... | Create a pushable JDK 8 Stream
<pre>
{@code
PushableStream<Integer> pushable = StreamSource.ofUnbounded()
.stream();
pushable.getInput()
.add(10);
pushable.getInput()
.close();
pushable.getStream().collect(CyclopsCollectors.toList()) //[10]
}
</pre>
@return PushableStream that can accept data to push into a Java 8... | [
"Create",
"a",
"pushable",
"JDK",
"8",
"Stream"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/cyclops/stream/StreamSource.java#L495-L500 |
48,157 | aol/cyclops | cyclops/src/main/java/com/oath/cyclops/util/ExceptionSoftener.java | ExceptionSoftener.softenRunnable | public static Runnable softenRunnable(final CheckedRunnable s) {
return () -> {
try {
s.run();
} catch (final Throwable e) {
throw throwSoftenedException(e);
}
};
} | java | public static Runnable softenRunnable(final CheckedRunnable s) {
return () -> {
try {
s.run();
} catch (final Throwable e) {
throw throwSoftenedException(e);
}
};
} | [
"public",
"static",
"Runnable",
"softenRunnable",
"(",
"final",
"CheckedRunnable",
"s",
")",
"{",
"return",
"(",
")",
"->",
"{",
"try",
"{",
"s",
".",
"run",
"(",
")",
";",
"}",
"catch",
"(",
"final",
"Throwable",
"e",
")",
"{",
"throw",
"throwSoftened... | Soften a Runnable that throws a ChecekdException into a plain old Runnable
<pre>
{@code
Runnable runnable = ExceptionSoftener.softenRunnable(this::run);
runnable.run() //thows IOException but doesn't need to declare it
private void run() throws IOException{
throw new IOException();
}
ExceptionSoftener.softenRunnabl... | [
"Soften",
"a",
"Runnable",
"that",
"throws",
"a",
"ChecekdException",
"into",
"a",
"plain",
"old",
"Runnable"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/util/ExceptionSoftener.java#L79-L87 |
48,158 | aol/cyclops | cyclops/src/main/java/com/oath/cyclops/util/ExceptionSoftener.java | ExceptionSoftener.softenSupplier | public static <T> Supplier<T> softenSupplier(final CheckedSupplier<T> s) {
return () -> {
try {
return s.get();
} catch (final Throwable e) {
throw throwSoftenedException(e);
}
};
} | java | public static <T> Supplier<T> softenSupplier(final CheckedSupplier<T> s) {
return () -> {
try {
return s.get();
} catch (final Throwable e) {
throw throwSoftenedException(e);
}
};
} | [
"public",
"static",
"<",
"T",
">",
"Supplier",
"<",
"T",
">",
"softenSupplier",
"(",
"final",
"CheckedSupplier",
"<",
"T",
">",
"s",
")",
"{",
"return",
"(",
")",
"->",
"{",
"try",
"{",
"return",
"s",
".",
"get",
"(",
")",
";",
"}",
"catch",
"(",... | Soften a Supplier that throws a ChecekdException into a plain old Supplier
<pre>
{@code
Supplier<String> supplier = ExceptionSoftener.softenSupplier(this::getValue);
supplier.getValue(); //thows IOException but doesn't need to declare it
private String getValue() throws IOException{
return "hello";
}
}
</pre>
@pa... | [
"Soften",
"a",
"Supplier",
"that",
"throws",
"a",
"ChecekdException",
"into",
"a",
"plain",
"old",
"Supplier"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/util/ExceptionSoftener.java#L110-L118 |
48,159 | aol/cyclops | cyclops/src/main/java/com/oath/cyclops/util/ExceptionSoftener.java | ExceptionSoftener.softenCallable | public static <T> Supplier<T> softenCallable(final Callable<T> s) {
return () -> {
try {
return s.call();
} catch (final Throwable e) {
throw throwSoftenedException(e);
}
};
} | java | public static <T> Supplier<T> softenCallable(final Callable<T> s) {
return () -> {
try {
return s.call();
} catch (final Throwable e) {
throw throwSoftenedException(e);
}
};
} | [
"public",
"static",
"<",
"T",
">",
"Supplier",
"<",
"T",
">",
"softenCallable",
"(",
"final",
"Callable",
"<",
"T",
">",
"s",
")",
"{",
"return",
"(",
")",
"->",
"{",
"try",
"{",
"return",
"s",
".",
"call",
"(",
")",
";",
"}",
"catch",
"(",
"fi... | Soften a Callable that throws a ChecekdException into a Supplier
<pre>
{@code
Supplier<String> supplier = ExceptionSoftener.softenCallable(this);
supplier.getValue(); //thows IOException but doesn't need to declare it
public String call() throws IOException{
return "hello";
}
}
</pre>
@param s Callable with Check... | [
"Soften",
"a",
"Callable",
"that",
"throws",
"a",
"ChecekdException",
"into",
"a",
"Supplier"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/util/ExceptionSoftener.java#L141-L149 |
48,160 | aol/cyclops | cyclops/src/main/java/com/oath/cyclops/util/ExceptionSoftener.java | ExceptionSoftener.softenBooleanSupplier | public static BooleanSupplier softenBooleanSupplier(final CheckedBooleanSupplier s) {
return () -> {
try {
return s.getAsBoolean();
} catch (final Throwable e) {
throw throwSoftenedException(e);
}
};
} | java | public static BooleanSupplier softenBooleanSupplier(final CheckedBooleanSupplier s) {
return () -> {
try {
return s.getAsBoolean();
} catch (final Throwable e) {
throw throwSoftenedException(e);
}
};
} | [
"public",
"static",
"BooleanSupplier",
"softenBooleanSupplier",
"(",
"final",
"CheckedBooleanSupplier",
"s",
")",
"{",
"return",
"(",
")",
"->",
"{",
"try",
"{",
"return",
"s",
".",
"getAsBoolean",
"(",
")",
";",
"}",
"catch",
"(",
"final",
"Throwable",
"e",... | Soften a BooleanSuppler that throws a checked exception into one that still throws the exception, but doesn't need to declare it.
<pre>
{@code
assertThat(ExceptionSoftener.softenBooleanSupplier(()->true).getAsBoolean(),equalTo(true));
BooleanSupplier supplier = ExceptionSoftener.softenBooleanSupplier(()->{throw new... | [
"Soften",
"a",
"BooleanSuppler",
"that",
"throws",
"a",
"checked",
"exception",
"into",
"one",
"that",
"still",
"throws",
"the",
"exception",
"but",
"doesn",
"t",
"need",
"to",
"declare",
"it",
"."
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/util/ExceptionSoftener.java#L170-L178 |
48,161 | aol/cyclops | cyclops/src/main/java/com/oath/cyclops/util/ExceptionSoftener.java | ExceptionSoftener.throwIf | public static <X extends Throwable> void throwIf(final X e, final Predicate<X> p) {
if (p.test(e))
throw ExceptionSoftener.<RuntimeException> uncheck(e);
} | java | public static <X extends Throwable> void throwIf(final X e, final Predicate<X> p) {
if (p.test(e))
throw ExceptionSoftener.<RuntimeException> uncheck(e);
} | [
"public",
"static",
"<",
"X",
"extends",
"Throwable",
">",
"void",
"throwIf",
"(",
"final",
"X",
"e",
",",
"final",
"Predicate",
"<",
"X",
">",
"p",
")",
"{",
"if",
"(",
"p",
".",
"test",
"(",
"e",
")",
")",
"throw",
"ExceptionSoftener",
".",
"<",
... | Throw the exception as upwards if the predicate holds, otherwise do nothing
@param e Exception
@param p Predicate to check exception should be thrown or not | [
"Throw",
"the",
"exception",
"as",
"upwards",
"if",
"the",
"predicate",
"holds",
"otherwise",
"do",
"nothing"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/util/ExceptionSoftener.java#L680-L683 |
48,162 | aol/cyclops | cyclops/src/main/java/com/oath/cyclops/util/ExceptionSoftener.java | ExceptionSoftener.throwOrHandle | public static <X extends Throwable> void throwOrHandle(final X e, final Predicate<X> p, final Consumer<X> handler) {
if (p.test(e))
throw ExceptionSoftener.<RuntimeException> uncheck(e);
else
handler.accept(e);
} | java | public static <X extends Throwable> void throwOrHandle(final X e, final Predicate<X> p, final Consumer<X> handler) {
if (p.test(e))
throw ExceptionSoftener.<RuntimeException> uncheck(e);
else
handler.accept(e);
} | [
"public",
"static",
"<",
"X",
"extends",
"Throwable",
">",
"void",
"throwOrHandle",
"(",
"final",
"X",
"e",
",",
"final",
"Predicate",
"<",
"X",
">",
"p",
",",
"final",
"Consumer",
"<",
"X",
">",
"handler",
")",
"{",
"if",
"(",
"p",
".",
"test",
"(... | Throw the exception as upwards if the predicate holds, otherwise pass to the handler
@param e Exception
@param p Predicate to check exception should be thrown or not
@param handler Handles exceptions that should not be thrown | [
"Throw",
"the",
"exception",
"as",
"upwards",
"if",
"the",
"predicate",
"holds",
"otherwise",
"pass",
"to",
"the",
"handler"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/util/ExceptionSoftener.java#L692-L697 |
48,163 | aol/cyclops | cyclops/src/main/java/cyclops/companion/Optionals.java | Optionals.forEach2 | public static <T, R1, R> Optional<R> forEach2(Optional<? extends T> value1, Function<? super T, Optional<R1>> value2,
BiFunction<? super T, ? super R1, ? extends R> yieldingFunction) {
return value1.flatMap(in -> {
Optional<R1> a = value2.apply(in);... | java | public static <T, R1, R> Optional<R> forEach2(Optional<? extends T> value1, Function<? super T, Optional<R1>> value2,
BiFunction<? super T, ? super R1, ? extends R> yieldingFunction) {
return value1.flatMap(in -> {
Optional<R1> a = value2.apply(in);... | [
"public",
"static",
"<",
"T",
",",
"R1",
",",
"R",
">",
"Optional",
"<",
"R",
">",
"forEach2",
"(",
"Optional",
"<",
"?",
"extends",
"T",
">",
"value1",
",",
"Function",
"<",
"?",
"super",
"T",
",",
"Optional",
"<",
"R1",
">",
">",
"value2",
",",... | Perform a For Comprehension over a Optional, accepting a generating function.
This results in a two level nested internal iteration over the provided Optionals.
<pre>
{@code
import static com.oath.cyclops.reactor.Optionals.forEach;
forEach(Optional.just(1),
a-> Optional.just(a+1),
Tuple::tuple)
}
</pre>
@param val... | [
"Perform",
"a",
"For",
"Comprehension",
"over",
"a",
"Optional",
"accepting",
"a",
"generating",
"function",
".",
"This",
"results",
"in",
"a",
"two",
"level",
"nested",
"internal",
"iteration",
"over",
"the",
"provided",
"Optionals",
"."
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Optionals.java#L267-L278 |
48,164 | aol/cyclops | cyclops/src/main/java/com/oath/cyclops/async/adapters/Topic.java | Topic.disconnect | @Synchronized("lock")
public void disconnect(final ReactiveSeq<T> stream) {
Option<Queue<T>> o = streamToQueue.get(stream);
distributor.removeQueue(streamToQueue.getOrElse(stream, new Queue<>()));
this.streamToQueue = streamToQueue.remove(stream);
this.index--;
} | java | @Synchronized("lock")
public void disconnect(final ReactiveSeq<T> stream) {
Option<Queue<T>> o = streamToQueue.get(stream);
distributor.removeQueue(streamToQueue.getOrElse(stream, new Queue<>()));
this.streamToQueue = streamToQueue.remove(stream);
this.index--;
} | [
"@",
"Synchronized",
"(",
"\"lock\"",
")",
"public",
"void",
"disconnect",
"(",
"final",
"ReactiveSeq",
"<",
"T",
">",
"stream",
")",
"{",
"Option",
"<",
"Queue",
"<",
"T",
">>",
"o",
"=",
"streamToQueue",
".",
"get",
"(",
"stream",
")",
";",
"distribu... | Topic will maintain a queue for each Subscribing Stream
If a Stream is finished with a Topic it is good practice to disconnect from the Topic
so messages will no longer be stored for that Stream
@param stream | [
"Topic",
"will",
"maintain",
"a",
"queue",
"for",
"each",
"Subscribing",
"Stream",
"If",
"a",
"Stream",
"is",
"finished",
"with",
"a",
"Topic",
"it",
"is",
"good",
"practice",
"to",
"disconnect",
"from",
"the",
"Topic",
"so",
"messages",
"will",
"no",
"lon... | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/async/adapters/Topic.java#L71-L79 |
48,165 | aol/cyclops | cyclops/src/main/java/cyclops/control/Future.java | Future.narrowK | public static <T> Future<T> narrowK(final Higher<future, T> future) {
return (Future<T>)future;
} | java | public static <T> Future<T> narrowK(final Higher<future, T> future) {
return (Future<T>)future;
} | [
"public",
"static",
"<",
"T",
">",
"Future",
"<",
"T",
">",
"narrowK",
"(",
"final",
"Higher",
"<",
"future",
",",
"T",
">",
"future",
")",
"{",
"return",
"(",
"Future",
"<",
"T",
">",
")",
"future",
";",
"}"
] | Convert the raw Higher Kinded Type for FutureType types into the FutureType type definition class
@param future HKT encoded list into a FutureType
@return FutureType | [
"Convert",
"the",
"raw",
"Higher",
"Kinded",
"Type",
"for",
"FutureType",
"types",
"into",
"the",
"FutureType",
"type",
"definition",
"class"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/control/Future.java#L140-L142 |
48,166 | aol/cyclops | cyclops/src/main/java/cyclops/control/Future.java | Future.anyOf | public static <T> Future<T> anyOf(Future<T>... fts) {
CompletableFuture<T>[] array = new CompletableFuture[fts.length];
for(int i=0;i<fts.length;i++){
array[i] = fts[i].getFuture();
}
return (Future<T>) Future.of(CompletableFuture.anyOf(array));
} | java | public static <T> Future<T> anyOf(Future<T>... fts) {
CompletableFuture<T>[] array = new CompletableFuture[fts.length];
for(int i=0;i<fts.length;i++){
array[i] = fts[i].getFuture();
}
return (Future<T>) Future.of(CompletableFuture.anyOf(array));
} | [
"public",
"static",
"<",
"T",
">",
"Future",
"<",
"T",
">",
"anyOf",
"(",
"Future",
"<",
"T",
">",
"...",
"fts",
")",
"{",
"CompletableFuture",
"<",
"T",
">",
"[",
"]",
"array",
"=",
"new",
"CompletableFuture",
"[",
"fts",
".",
"length",
"]",
";",
... | Select the first Future to complete
@see CompletableFuture#anyOf(CompletableFuture...)
@param fts Futures to race
@return First Future to complete | [
"Select",
"the",
"first",
"Future",
"to",
"complete"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/control/Future.java#L170-L177 |
48,167 | aol/cyclops | cyclops/src/main/java/cyclops/control/Future.java | Future.fromPublisher | public static <T> Future<T> fromPublisher(final Publisher<T> pub, final Executor ex) {
final ValueSubscriber<T> sub = ValueSubscriber.subscriber();
pub.subscribe(sub);
return sub.toFutureAsync(ex);
} | java | public static <T> Future<T> fromPublisher(final Publisher<T> pub, final Executor ex) {
final ValueSubscriber<T> sub = ValueSubscriber.subscriber();
pub.subscribe(sub);
return sub.toFutureAsync(ex);
} | [
"public",
"static",
"<",
"T",
">",
"Future",
"<",
"T",
">",
"fromPublisher",
"(",
"final",
"Publisher",
"<",
"T",
">",
"pub",
",",
"final",
"Executor",
"ex",
")",
"{",
"final",
"ValueSubscriber",
"<",
"T",
">",
"sub",
"=",
"ValueSubscriber",
".",
"subs... | Construct a Future asynchronously that contains a single value extracted from the supplied reactive-streams Publisher
<pre>
{@code
ReactiveSeq<Integer> stream = ReactiveSeq.of(1,2,3);
Future<Integer> future = Future.fromPublisher(stream,ex);
Future[1]
}
</pre>
@param pub Publisher to extract value from
@param e... | [
"Construct",
"a",
"Future",
"asynchronously",
"that",
"contains",
"a",
"single",
"value",
"extracted",
"from",
"the",
"supplied",
"reactive",
"-",
"streams",
"Publisher"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/control/Future.java#L251-L255 |
48,168 | aol/cyclops | cyclops/src/main/java/cyclops/control/Future.java | Future.fromIterable | public static <T> Future<T> fromIterable(final Iterable<T> iterable) {
if(iterable instanceof Future){
return (Future)iterable;
}
return Future.ofResult(Eval.fromIterable(iterable))
.map(e -> e.get());
} | java | public static <T> Future<T> fromIterable(final Iterable<T> iterable) {
if(iterable instanceof Future){
return (Future)iterable;
}
return Future.ofResult(Eval.fromIterable(iterable))
.map(e -> e.get());
} | [
"public",
"static",
"<",
"T",
">",
"Future",
"<",
"T",
">",
"fromIterable",
"(",
"final",
"Iterable",
"<",
"T",
">",
"iterable",
")",
"{",
"if",
"(",
"iterable",
"instanceof",
"Future",
")",
"{",
"return",
"(",
"Future",
")",
"iterable",
";",
"}",
"r... | Construct a Future syncrhonously that contains a single value extracted from the supplied Iterable
<pre>
{@code
ReactiveSeq<Integer> stream = ReactiveSeq.of(1,2,3);
Future<Integer> future = Future.fromIterable(stream);
Future[1]
}
</pre>
@param iterable Iterable to extract value from
@return Future populated syn... | [
"Construct",
"a",
"Future",
"syncrhonously",
"that",
"contains",
"a",
"single",
"value",
"extracted",
"from",
"the",
"supplied",
"Iterable"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/control/Future.java#L344-L350 |
48,169 | aol/cyclops | cyclops/src/main/java/cyclops/control/Future.java | Future.fromTry | public static <T, X extends Throwable> Future<T> fromTry(final Try<T, X> value) {
return value.fold(s->Future.ofResult(s), e->Future.<T>of(CompletableFutures.error(e)));
} | java | public static <T, X extends Throwable> Future<T> fromTry(final Try<T, X> value) {
return value.fold(s->Future.ofResult(s), e->Future.<T>of(CompletableFutures.error(e)));
} | [
"public",
"static",
"<",
"T",
",",
"X",
"extends",
"Throwable",
">",
"Future",
"<",
"T",
">",
"fromTry",
"(",
"final",
"Try",
"<",
"T",
",",
"X",
">",
"value",
")",
"{",
"return",
"value",
".",
"fold",
"(",
"s",
"->",
"Future",
".",
"ofResult",
"... | Construct a Future syncrhonously from the Supplied Try
@param value Try to populate Future from
@return Future populated with lazy the value or error in provided Try | [
"Construct",
"a",
"Future",
"syncrhonously",
"from",
"the",
"Supplied",
"Try"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/control/Future.java#L394-L397 |
48,170 | aol/cyclops | cyclops/src/main/java/cyclops/control/Future.java | Future.sequence | public static <T> Future<ReactiveSeq<T>> sequence(final Stream<? extends Future<T>> fts) {
return sequence(ReactiveSeq.fromStream(fts));
} | java | public static <T> Future<ReactiveSeq<T>> sequence(final Stream<? extends Future<T>> fts) {
return sequence(ReactiveSeq.fromStream(fts));
} | [
"public",
"static",
"<",
"T",
">",
"Future",
"<",
"ReactiveSeq",
"<",
"T",
">",
">",
"sequence",
"(",
"final",
"Stream",
"<",
"?",
"extends",
"Future",
"<",
"T",
">",
">",
"fts",
")",
"{",
"return",
"sequence",
"(",
"ReactiveSeq",
".",
"fromStream",
... | Sequence operation that convert a Stream of Futures to a Future with a Stream
<pre>
{@code
Future<Integer> just = Future.ofResult(10);
Future<ReactiveSeq<Integer>> futures =Future.sequence(Stream.of(just,Future.ofResult(1)));
Seq.of(10,1)
}
</pre>
@param fts Strean of Futures to Sequence into a Future with a Stream
... | [
"Sequence",
"operation",
"that",
"convert",
"a",
"Stream",
"of",
"Futures",
"to",
"a",
"Future",
"with",
"a",
"Stream"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/control/Future.java#L509-L511 |
48,171 | aol/cyclops | cyclops/src/main/java/cyclops/control/Future.java | Future.visitAsync | @Deprecated //use foldAsync
public <R> Future<R> visitAsync(Function<? super T,? extends R> success, Function<? super Throwable,? extends R> failure){
return foldAsync(success,failure);
} | java | @Deprecated //use foldAsync
public <R> Future<R> visitAsync(Function<? super T,? extends R> success, Function<? super Throwable,? extends R> failure){
return foldAsync(success,failure);
} | [
"@",
"Deprecated",
"//use foldAsync",
"public",
"<",
"R",
">",
"Future",
"<",
"R",
">",
"visitAsync",
"(",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"R",
">",
"success",
",",
"Function",
"<",
"?",
"super",
"Throwable",
",",
"?",
"extends... | Non-blocking visit on the state of this Future
<pre>
{@code
Future.ofResult(10)
.visitAsync(i->i*2, e->-1);
Future[20]
Future.<Integer>ofError(new RuntimeException())
.visitAsync(i->i*2, e->-1)
Future[-1]
}
</pre>
@param success Function to execute if the previous stage completes successfully
@param failure Functio... | [
"Non",
"-",
"blocking",
"visit",
"on",
"the",
"state",
"of",
"this",
"Future"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/control/Future.java#L761-L764 |
48,172 | aol/cyclops | cyclops/src/main/java/cyclops/control/Future.java | Future.fold | public <R> R fold(Function<? super T,? extends R> success, Function<? super Throwable,? extends R> failure){
try {
return success.apply(future.join());
}catch(Throwable t){
return failure.apply(t);
}
} | java | public <R> R fold(Function<? super T,? extends R> success, Function<? super Throwable,? extends R> failure){
try {
return success.apply(future.join());
}catch(Throwable t){
return failure.apply(t);
}
} | [
"public",
"<",
"R",
">",
"R",
"fold",
"(",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"R",
">",
"success",
",",
"Function",
"<",
"?",
"super",
"Throwable",
",",
"?",
"extends",
"R",
">",
"failure",
")",
"{",
"try",
"{",
"return",
"s... | Blocking analogue to visitAsync. Visit the state of this Future, block until ready.
<pre>
{@code
Future.ofResult(10)
.visit(i->i*2, e->-1);
20
Future.<Integer>ofError(new RuntimeException())
.visit(i->i*2, e->-1)
[-1]
}
</pre>
@param success Function to execute if the previous stage completes successfully
@param fai... | [
"Blocking",
"analogue",
"to",
"visitAsync",
".",
"Visit",
"the",
"state",
"of",
"this",
"Future",
"block",
"until",
"ready",
"."
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/control/Future.java#L788-L795 |
48,173 | aol/cyclops | cyclops/src/main/java/cyclops/control/Future.java | Future.map | public <R> Future<R> map(final Function<? super T, ? extends R> fn, Executor ex) {
return new Future<R>(
future.thenApplyAsync(fn,ex));
} | java | public <R> Future<R> map(final Function<? super T, ? extends R> fn, Executor ex) {
return new Future<R>(
future.thenApplyAsync(fn,ex));
} | [
"public",
"<",
"R",
">",
"Future",
"<",
"R",
">",
"map",
"(",
"final",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"R",
">",
"fn",
",",
"Executor",
"ex",
")",
"{",
"return",
"new",
"Future",
"<",
"R",
">",
"(",
"future",
".",
"then... | Asyncrhonous transform operation
@see CompletableFuture#thenApplyAsync(Function, Executor)
@param fn Transformation function
@param ex Executor to execute the transformation asynchronously
@return Mapped Future | [
"Asyncrhonous",
"transform",
"operation"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/control/Future.java#L819-L822 |
48,174 | aol/cyclops | cyclops/src/main/java/cyclops/control/Future.java | Future.flatMapCf | public <R> Future<R> flatMapCf(final Function<? super T, ? extends CompletionStage<? extends R>> mapper) {
return Future.<R> of(future.<R> thenCompose(t -> (CompletionStage<R>) mapper.apply(t)));
} | java | public <R> Future<R> flatMapCf(final Function<? super T, ? extends CompletionStage<? extends R>> mapper) {
return Future.<R> of(future.<R> thenCompose(t -> (CompletionStage<R>) mapper.apply(t)));
} | [
"public",
"<",
"R",
">",
"Future",
"<",
"R",
">",
"flatMapCf",
"(",
"final",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"CompletionStage",
"<",
"?",
"extends",
"R",
">",
">",
"mapper",
")",
"{",
"return",
"Future",
".",
"<",
"R",
">",... | A flatMap operation that accepts a CompleteableFuture CompletionStage as
the return type
@param mapper
Mapping function
@return FlatMapped Future | [
"A",
"flatMap",
"operation",
"that",
"accepts",
"a",
"CompleteableFuture",
"CompletionStage",
"as",
"the",
"return",
"type"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/control/Future.java#L958-L960 |
48,175 | aol/cyclops | cyclops/src/main/java/cyclops/control/Future.java | Future.recover | public Future<T> recover(final Function<? super Throwable, ? extends T> fn) {
return Future.of(toCompletableFuture().exceptionally((Function)fn));
} | java | public Future<T> recover(final Function<? super Throwable, ? extends T> fn) {
return Future.of(toCompletableFuture().exceptionally((Function)fn));
} | [
"public",
"Future",
"<",
"T",
">",
"recover",
"(",
"final",
"Function",
"<",
"?",
"super",
"Throwable",
",",
"?",
"extends",
"T",
">",
"fn",
")",
"{",
"return",
"Future",
".",
"of",
"(",
"toCompletableFuture",
"(",
")",
".",
"exceptionally",
"(",
"(",
... | Returns a new Future that, when this Future completes exceptionally is
executed with this Future exception as the argument to the supplied
function. Otherwise, if this Future completes normally, applyHKT the
returned Future also completes normally with the same value.
<pre>
{@code
Future.ofError(new RuntimeException()... | [
"Returns",
"a",
"new",
"Future",
"that",
"when",
"this",
"Future",
"completes",
"exceptionally",
"is",
"executed",
"with",
"this",
"Future",
"exception",
"as",
"the",
"argument",
"to",
"the",
"supplied",
"function",
".",
"Otherwise",
"if",
"this",
"Future",
"c... | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/control/Future.java#L1017-L1019 |
48,176 | aol/cyclops | cyclops/src/main/java/cyclops/control/Future.java | Future.map | public <R> Future<R> map(final Function<? super T, R> success, final Function<Throwable, R> failure) {
return Future.of(future.thenApply(success)
.exceptionally(failure));
} | java | public <R> Future<R> map(final Function<? super T, R> success, final Function<Throwable, R> failure) {
return Future.of(future.thenApply(success)
.exceptionally(failure));
} | [
"public",
"<",
"R",
">",
"Future",
"<",
"R",
">",
"map",
"(",
"final",
"Function",
"<",
"?",
"super",
"T",
",",
"R",
">",
"success",
",",
"final",
"Function",
"<",
"Throwable",
",",
"R",
">",
"failure",
")",
"{",
"return",
"Future",
".",
"of",
"(... | Map this Future differently depending on whether the previous stage
completed successfully or failed
<pre>
{@code
Future.ofResult(1)
.map(i->i*2,e->-1);
//Future[2]
}</pre>
@param success
Mapping function for successful outcomes
@param failure
Mapping function for failed outcomes
@return New Future mapped to a new s... | [
"Map",
"this",
"Future",
"differently",
"depending",
"on",
"whether",
"the",
"previous",
"stage",
"completed",
"successfully",
"or",
"failed"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/control/Future.java#L1042-L1045 |
48,177 | aol/cyclops | cyclops/src/main/java/cyclops/control/Future.java | Future.ofResult | public static <T> Future<T> ofResult(final T result) {
return Future.of(CompletableFuture.completedFuture(result));
} | java | public static <T> Future<T> ofResult(final T result) {
return Future.of(CompletableFuture.completedFuture(result));
} | [
"public",
"static",
"<",
"T",
">",
"Future",
"<",
"T",
">",
"ofResult",
"(",
"final",
"T",
"result",
")",
"{",
"return",
"Future",
".",
"of",
"(",
"CompletableFuture",
".",
"completedFuture",
"(",
"result",
")",
")",
";",
"}"
] | Construct a successfully completed Future from the given value
@param result
To wrap inside a Future
@return Future containing supplied result | [
"Construct",
"a",
"successfully",
"completed",
"Future",
"from",
"the",
"given",
"value"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/control/Future.java#L1079-L1081 |
48,178 | aol/cyclops | cyclops/src/main/java/cyclops/control/Future.java | Future.ofError | public static <T> Future<T> ofError(final Throwable error) {
final CompletableFuture<T> cf = new CompletableFuture<>();
cf.completeExceptionally(error);
return Future.<T> of(cf);
} | java | public static <T> Future<T> ofError(final Throwable error) {
final CompletableFuture<T> cf = new CompletableFuture<>();
cf.completeExceptionally(error);
return Future.<T> of(cf);
} | [
"public",
"static",
"<",
"T",
">",
"Future",
"<",
"T",
">",
"ofError",
"(",
"final",
"Throwable",
"error",
")",
"{",
"final",
"CompletableFuture",
"<",
"T",
">",
"cf",
"=",
"new",
"CompletableFuture",
"<>",
"(",
")",
";",
"cf",
".",
"completeExceptionall... | Construct a completed-with-error Future from the given Exception
@param error
To wrap inside a Future
@return Future containing supplied error | [
"Construct",
"a",
"completed",
"-",
"with",
"-",
"error",
"Future",
"from",
"the",
"given",
"Exception"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/control/Future.java#L1090-L1095 |
48,179 | aol/cyclops | cyclops/src/main/java/cyclops/control/Future.java | Future.of | public static <T> Future<T> of(final Supplier<T> s) {
return Future.of(CompletableFuture.supplyAsync(s));
} | java | public static <T> Future<T> of(final Supplier<T> s) {
return Future.of(CompletableFuture.supplyAsync(s));
} | [
"public",
"static",
"<",
"T",
">",
"Future",
"<",
"T",
">",
"of",
"(",
"final",
"Supplier",
"<",
"T",
">",
"s",
")",
"{",
"return",
"Future",
".",
"of",
"(",
"CompletableFuture",
".",
"supplyAsync",
"(",
"s",
")",
")",
";",
"}"
] | Create a Future object that asyncrhonously populates using the Common
ForkJoinPool from the user provided Supplier
@param s
Supplier to asynchronously populate results from
@return Future asynchronously populated from the Supplier | [
"Create",
"a",
"Future",
"object",
"that",
"asyncrhonously",
"populates",
"using",
"the",
"Common",
"ForkJoinPool",
"from",
"the",
"user",
"provided",
"Supplier"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/control/Future.java#L1203-L1205 |
48,180 | aol/cyclops | cyclops/src/main/java/cyclops/control/Future.java | Future.of | public static <T> Future<T> of(final Supplier<T> s, final Executor ex) {
return Future.of(CompletableFuture.supplyAsync(s, ex));
} | java | public static <T> Future<T> of(final Supplier<T> s, final Executor ex) {
return Future.of(CompletableFuture.supplyAsync(s, ex));
} | [
"public",
"static",
"<",
"T",
">",
"Future",
"<",
"T",
">",
"of",
"(",
"final",
"Supplier",
"<",
"T",
">",
"s",
",",
"final",
"Executor",
"ex",
")",
"{",
"return",
"Future",
".",
"of",
"(",
"CompletableFuture",
".",
"supplyAsync",
"(",
"s",
",",
"e... | Create a Future object that asyncrhonously populates using the provided
Executor and Supplier
@param s
Supplier to asynchronously populate results from
@param ex
Executro to asynchronously populate results with
@return Future asynchronously populated from the Supplier | [
"Create",
"a",
"Future",
"object",
"that",
"asyncrhonously",
"populates",
"using",
"the",
"provided",
"Executor",
"and",
"Supplier"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/control/Future.java#L1217-L1219 |
48,181 | aol/cyclops | cyclops/src/main/java/com/oath/cyclops/util/box/MutableFloat.java | MutableFloat.fromExternal | public static MutableFloat fromExternal(final Supplier<Float> s, final Consumer<Float> c) {
return new MutableFloat() {
@Override
public float getAsFloat() {
return s.get();
}
@Override
public Float get() {
return getAs... | java | public static MutableFloat fromExternal(final Supplier<Float> s, final Consumer<Float> c) {
return new MutableFloat() {
@Override
public float getAsFloat() {
return s.get();
}
@Override
public Float get() {
return getAs... | [
"public",
"static",
"MutableFloat",
"fromExternal",
"(",
"final",
"Supplier",
"<",
"Float",
">",
"s",
",",
"final",
"Consumer",
"<",
"Float",
">",
"c",
")",
"{",
"return",
"new",
"MutableFloat",
"(",
")",
"{",
"@",
"Override",
"public",
"float",
"getAsFloa... | Construct a MutableFloat that gets and sets an external value using the provided Supplier and Consumer
e.g.
<pre>
{@code
MutableFloat mutable = MutableFloat.fromExternal(()->!this.value,val->!this.value);
}
</pre>
@param s Supplier of an external value
@param c Consumer that sets an external value
@return MutableFlo... | [
"Construct",
"a",
"MutableFloat",
"that",
"gets",
"and",
"sets",
"an",
"external",
"value",
"using",
"the",
"provided",
"Supplier",
"and",
"Consumer"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/util/box/MutableFloat.java#L80-L98 |
48,182 | aol/cyclops | cyclops/src/main/java/com/oath/cyclops/util/box/MutableBoolean.java | MutableBoolean.fromExternal | public static MutableBoolean fromExternal(final BooleanSupplier s, final Consumer<Boolean> c) {
return new MutableBoolean() {
@Override
public boolean getAsBoolean() {
return s.getAsBoolean();
}
@Override
public Boolean get() {
... | java | public static MutableBoolean fromExternal(final BooleanSupplier s, final Consumer<Boolean> c) {
return new MutableBoolean() {
@Override
public boolean getAsBoolean() {
return s.getAsBoolean();
}
@Override
public Boolean get() {
... | [
"public",
"static",
"MutableBoolean",
"fromExternal",
"(",
"final",
"BooleanSupplier",
"s",
",",
"final",
"Consumer",
"<",
"Boolean",
">",
"c",
")",
"{",
"return",
"new",
"MutableBoolean",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"getAsBoolean",
"(... | Construct a MutableBoolean that gets and sets an external value using the provided Supplier and Consumer
e.g.
<pre>
{@code
MutableBoolean mutable = MutableBoolean.fromExternal(()->!this.value,val->!this.value);
}
</pre>
@param s Supplier of an external value
@param c Consumer that sets an external value
@return Muta... | [
"Construct",
"a",
"MutableBoolean",
"that",
"gets",
"and",
"sets",
"an",
"external",
"value",
"using",
"the",
"provided",
"Supplier",
"and",
"Consumer"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/util/box/MutableBoolean.java#L82-L100 |
48,183 | aol/cyclops | cyclops-futurestream/src/main/java/cyclops/futurestream/SimpleReact.java | SimpleReact.fromPublisher | public <T> SimpleReactStream<T> fromPublisher(final Publisher<? extends T> publisher) {
Objects.requireNonNull(publisher);
Publisher<T> narrowed = (Publisher<T>)publisher;
return from(Spouts.from(narrowed));
} | java | public <T> SimpleReactStream<T> fromPublisher(final Publisher<? extends T> publisher) {
Objects.requireNonNull(publisher);
Publisher<T> narrowed = (Publisher<T>)publisher;
return from(Spouts.from(narrowed));
} | [
"public",
"<",
"T",
">",
"SimpleReactStream",
"<",
"T",
">",
"fromPublisher",
"(",
"final",
"Publisher",
"<",
"?",
"extends",
"T",
">",
"publisher",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"publisher",
")",
";",
"Publisher",
"<",
"T",
">",
"narr... | Construct a SimpleReactStream from an Publisher
@param publisher
to construct SimpleReactStream from
@return SimpleReactStream | [
"Construct",
"a",
"SimpleReactStream",
"from",
"an",
"Publisher"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/cyclops/futurestream/SimpleReact.java#L166-L170 |
48,184 | aol/cyclops | cyclops-futurestream/src/main/java/cyclops/futurestream/SimpleReact.java | SimpleReact.parallelBuilder | public static SimpleReact parallelBuilder(final int parallelism) {
return SimpleReact.builder()
.executor(new ForkJoinPool(
parallelism))
.async(true)
.build();
} | java | public static SimpleReact parallelBuilder(final int parallelism) {
return SimpleReact.builder()
.executor(new ForkJoinPool(
parallelism))
.async(true)
.build();
} | [
"public",
"static",
"SimpleReact",
"parallelBuilder",
"(",
"final",
"int",
"parallelism",
")",
"{",
"return",
"SimpleReact",
".",
"builder",
"(",
")",
".",
"executor",
"(",
"new",
"ForkJoinPool",
"(",
"parallelism",
")",
")",
".",
"async",
"(",
"true",
")",
... | Construct a new SimpleReact builder, with a new task executor and retry executor
with configured number of threads
@param parallelism Number of threads task executor should have
@return eager SimpleReact instance | [
"Construct",
"a",
"new",
"SimpleReact",
"builder",
"with",
"a",
"new",
"task",
"executor",
"and",
"retry",
"executor",
"with",
"configured",
"number",
"of",
"threads"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/cyclops/futurestream/SimpleReact.java#L278-L284 |
48,185 | aol/cyclops | cyclops-futurestream/src/main/java/cyclops/futurestream/SimpleReact.java | SimpleReact.fromIterable | @SuppressWarnings("unchecked")
public <U> SimpleReactStream<U> fromIterable(final Iterable<U> iter) {
if(iter instanceof SimpleReactStream){
return (SimpleReactStream<U>)iter;
}
return this.from(StreamSupport.stream(Spliterators.spliteratorUnknownSize(iter.iterator(), Spliterator... | java | @SuppressWarnings("unchecked")
public <U> SimpleReactStream<U> fromIterable(final Iterable<U> iter) {
if(iter instanceof SimpleReactStream){
return (SimpleReactStream<U>)iter;
}
return this.from(StreamSupport.stream(Spliterators.spliteratorUnknownSize(iter.iterator(), Spliterator... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"U",
">",
"SimpleReactStream",
"<",
"U",
">",
"fromIterable",
"(",
"final",
"Iterable",
"<",
"U",
">",
"iter",
")",
"{",
"if",
"(",
"iter",
"instanceof",
"SimpleReactStream",
")",
"{",
"ret... | Start a reactive flow from a JDK Iterator
@param iter SimpleReact will iterate over this iterator concurrently to skip the reactive dataflow
@return Next stage in the reactive flow | [
"Start",
"a",
"reactive",
"flow",
"from",
"a",
"JDK",
"Iterator"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/cyclops/futurestream/SimpleReact.java#L348-L355 |
48,186 | aol/cyclops | cyclops/src/main/java/cyclops/control/Unrestricted.java | Unrestricted.forEach4 | public < T2, T3, R1, R2, R3> Unrestricted<R3> forEach4(Function<? super T, ? extends Unrestricted<R1>> value2,
BiFunction<? super T, ? super R1, ? extends Unrestricted<R2>> value3,
Function3<? super ... | java | public < T2, T3, R1, R2, R3> Unrestricted<R3> forEach4(Function<? super T, ? extends Unrestricted<R1>> value2,
BiFunction<? super T, ? super R1, ? extends Unrestricted<R2>> value3,
Function3<? super ... | [
"public",
"<",
"T2",
",",
"T3",
",",
"R1",
",",
"R2",
",",
"R3",
">",
"Unrestricted",
"<",
"R3",
">",
"forEach4",
"(",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"Unrestricted",
"<",
"R1",
">",
">",
"value2",
",",
"BiFunction",
"<",
... | Perform a For Comprehension over a Unrestricted, accepting 3 generating function.
This results in a four level nested internal iteration over the provided Computationss.
@param value1 top level Unrestricted
@param value2 Nested Unrestricted
@param value3 Nested Unrestricted
@param value4 Nested Unrestricted
@return R... | [
"Perform",
"a",
"For",
"Comprehension",
"over",
"a",
"Unrestricted",
"accepting",
"3",
"generating",
"function",
".",
"This",
"results",
"in",
"a",
"four",
"level",
"nested",
"internal",
"iteration",
"over",
"the",
"provided",
"Computationss",
"."
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/control/Unrestricted.java#L262-L281 |
48,187 | aol/cyclops | cyclops/src/main/java/cyclops/control/Unrestricted.java | Unrestricted.forEach3 | public <T2, R1, R2> Unrestricted<R2> forEach3(Function<? super T, ? extends Unrestricted<R1>> value2,
BiFunction<? super T, ? super R1, ? extends Unrestricted<R2>> value3) {
return this.flatMap(in -> {
Unrestricted<R1> a = value2.apply(in);
... | java | public <T2, R1, R2> Unrestricted<R2> forEach3(Function<? super T, ? extends Unrestricted<R1>> value2,
BiFunction<? super T, ? super R1, ? extends Unrestricted<R2>> value3) {
return this.flatMap(in -> {
Unrestricted<R1> a = value2.apply(in);
... | [
"public",
"<",
"T2",
",",
"R1",
",",
"R2",
">",
"Unrestricted",
"<",
"R2",
">",
"forEach3",
"(",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"Unrestricted",
"<",
"R1",
">",
">",
"value2",
",",
"BiFunction",
"<",
"?",
"super",
"T",
",",... | Perform a For Comprehension over a Unrestricted, accepting 2 generating function.
This results in a three level nested internal iteration over the provided Computationss.
@param value1 top level Unrestricted
@param value2 Nested Unrestricted
@param value3 Nested Unrestricted
@return Resulting Unrestricted | [
"Perform",
"a",
"For",
"Comprehension",
"over",
"a",
"Unrestricted",
"accepting",
"2",
"generating",
"function",
".",
"This",
"results",
"in",
"a",
"three",
"level",
"nested",
"internal",
"iteration",
"over",
"the",
"provided",
"Computationss",
"."
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/control/Unrestricted.java#L294-L308 |
48,188 | aol/cyclops | cyclops/src/main/java/cyclops/control/Unrestricted.java | Unrestricted.forEach2 | public <R1> Unrestricted<R1> forEach2(Function<? super T, Unrestricted<R1>> value2) {
return this.flatMap(in -> {
Unrestricted<R1> a = value2.apply(in);
return a;
});
} | java | public <R1> Unrestricted<R1> forEach2(Function<? super T, Unrestricted<R1>> value2) {
return this.flatMap(in -> {
Unrestricted<R1> a = value2.apply(in);
return a;
});
} | [
"public",
"<",
"R1",
">",
"Unrestricted",
"<",
"R1",
">",
"forEach2",
"(",
"Function",
"<",
"?",
"super",
"T",
",",
"Unrestricted",
"<",
"R1",
">",
">",
"value2",
")",
"{",
"return",
"this",
".",
"flatMap",
"(",
"in",
"->",
"{",
"Unrestricted",
"<",
... | Perform a For Comprehension over a Unrestricted, accepting a generating function.
This results in a two level nested internal iteration over the provided Computationss.
@param value2 Nested Unrestricted
@return Resulting Unrestricted | [
"Perform",
"a",
"For",
"Comprehension",
"over",
"a",
"Unrestricted",
"accepting",
"a",
"generating",
"function",
".",
"This",
"results",
"in",
"a",
"two",
"level",
"nested",
"internal",
"iteration",
"over",
"the",
"provided",
"Computationss",
"."
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/control/Unrestricted.java#L319-L330 |
48,189 | aol/cyclops | cyclops/src/main/java/cyclops/companion/Functions.java | Functions.arrowUnit | public static final <T,W extends Unit<T>> Function1<? super T,? extends W> arrowUnit(Unit<?> w){
return t-> (W)w.unit(t);
} | java | public static final <T,W extends Unit<T>> Function1<? super T,? extends W> arrowUnit(Unit<?> w){
return t-> (W)w.unit(t);
} | [
"public",
"static",
"final",
"<",
"T",
",",
"W",
"extends",
"Unit",
"<",
"T",
">",
">",
"Function1",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"W",
">",
"arrowUnit",
"(",
"Unit",
"<",
"?",
">",
"w",
")",
"{",
"return",
"t",
"->",
"(",
"W",
... | Use an existing instance of a type that implements Unit to create a KleisliM arrow for that type
<pre>
{@code
Seq<Integer> myList = Seq.of(1,2,3);
Fn1<? super String, ? extends Seq<String>> arrow = Functions.arrowUnit(myList);
Seq<String> list = arrow.applyHKT("hello world");
}
</pre>
@param w
@param <T>
@param <W>... | [
"Use",
"an",
"existing",
"instance",
"of",
"a",
"type",
"that",
"implements",
"Unit",
"to",
"create",
"a",
"KleisliM",
"arrow",
"for",
"that",
"type"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Functions.java#L80-L83 |
48,190 | aol/cyclops | cyclops/src/main/java/cyclops/control/Try.java | Try.CofromPublisher | public static <T> Try<T, Throwable> CofromPublisher(final Publisher<T> pub) {
return new Try<>(LazyEither.fromPublisher(pub),new Class[0]);
} | java | public static <T> Try<T, Throwable> CofromPublisher(final Publisher<T> pub) {
return new Try<>(LazyEither.fromPublisher(pub),new Class[0]);
} | [
"public",
"static",
"<",
"T",
">",
"Try",
"<",
"T",
",",
"Throwable",
">",
"CofromPublisher",
"(",
"final",
"Publisher",
"<",
"T",
">",
"pub",
")",
"{",
"return",
"new",
"Try",
"<>",
"(",
"LazyEither",
".",
"fromPublisher",
"(",
"pub",
")",
",",
"new... | Construct a Try that contains a single value extracted from the supplied reactive-streams Publisher
<pre>
{@code
ReactiveSeq<Integer> stream = Spouts.of(1,2,3);
Try<Integer,Throwable> recover = Try.fromPublisher(stream);
Try[1]
}
</pre>
@param pub Publisher to extract value from
@return Try populated with first ... | [
"Construct",
"a",
"Try",
"that",
"contains",
"a",
"single",
"value",
"extracted",
"from",
"the",
"supplied",
"reactive",
"-",
"streams",
"Publisher"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/control/Try.java#L330-L332 |
48,191 | aol/cyclops | cyclops/src/main/java/cyclops/control/Try.java | Try.fromIterable | public static <T, X extends Throwable> Try<T, X> fromIterable(final Iterable<T> iterable, T alt) {
if(iterable instanceof Try){
return (Try)iterable;
}
return new Try<>(LazyEither.fromIterable(iterable,alt), new Class[0]);
} | java | public static <T, X extends Throwable> Try<T, X> fromIterable(final Iterable<T> iterable, T alt) {
if(iterable instanceof Try){
return (Try)iterable;
}
return new Try<>(LazyEither.fromIterable(iterable,alt), new Class[0]);
} | [
"public",
"static",
"<",
"T",
",",
"X",
"extends",
"Throwable",
">",
"Try",
"<",
"T",
",",
"X",
">",
"fromIterable",
"(",
"final",
"Iterable",
"<",
"T",
">",
"iterable",
",",
"T",
"alt",
")",
"{",
"if",
"(",
"iterable",
"instanceof",
"Try",
")",
"{... | Construct a Try that contains a single value extracted from the supplied Iterable
<pre>
{@code
ReactiveSeq<Integer> stream = ReactiveSeq.of(1,2,3);
Try<Integer,Throwable> recover = Try.fromIterable(stream);
Try[1]
}
</pre>
@param iterable Iterable to extract value from
@return Try populated with first value from... | [
"Construct",
"a",
"Try",
"that",
"contains",
"a",
"single",
"value",
"extracted",
"from",
"the",
"supplied",
"Iterable"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/control/Try.java#L352-L357 |
48,192 | aol/cyclops | cyclops/src/main/java/cyclops/control/Try.java | Try.mapOrCatch | @SafeVarargs
public final <R> Try<R,X> mapOrCatch(CheckedFunction<? super T, ? extends R,X> fn, Class<? extends X>... classes){
return new Try<R,X>(xor.flatMap(i ->safeApply(i, fn.asFunction(),classes)),this.classes);
} | java | @SafeVarargs
public final <R> Try<R,X> mapOrCatch(CheckedFunction<? super T, ? extends R,X> fn, Class<? extends X>... classes){
return new Try<R,X>(xor.flatMap(i ->safeApply(i, fn.asFunction(),classes)),this.classes);
} | [
"@",
"SafeVarargs",
"public",
"final",
"<",
"R",
">",
"Try",
"<",
"R",
",",
"X",
">",
"mapOrCatch",
"(",
"CheckedFunction",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"R",
",",
"X",
">",
"fn",
",",
"Class",
"<",
"?",
"extends",
"X",
">",
"...",... | Perform a mapping operation that may catch the supplied Exception types
The supplied Exception types are only applied during this map operation
@param fn mapping function
@param classes exception types to catch
@param <R> return type of mapping function
@return Try with result or caught exception | [
"Perform",
"a",
"mapping",
"operation",
"that",
"may",
"catch",
"the",
"supplied",
"Exception",
"types",
"The",
"supplied",
"Exception",
"types",
"are",
"only",
"applied",
"during",
"this",
"map",
"operation"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/control/Try.java#L555-L558 |
48,193 | aol/cyclops | cyclops/src/main/java/cyclops/control/Try.java | Try.flatMapOrCatch | @SafeVarargs
public final <R> Try<R, X> flatMapOrCatch(CheckedFunction<? super T, ? extends Try<? extends R,X>,X> fn,Class<? extends X>... classes){
return new Try<>(xor.flatMap(i->safeApplyM(i, fn.asFunction(),classes).toEither()),classes);
} | java | @SafeVarargs
public final <R> Try<R, X> flatMapOrCatch(CheckedFunction<? super T, ? extends Try<? extends R,X>,X> fn,Class<? extends X>... classes){
return new Try<>(xor.flatMap(i->safeApplyM(i, fn.asFunction(),classes).toEither()),classes);
} | [
"@",
"SafeVarargs",
"public",
"final",
"<",
"R",
">",
"Try",
"<",
"R",
",",
"X",
">",
"flatMapOrCatch",
"(",
"CheckedFunction",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"Try",
"<",
"?",
"extends",
"R",
",",
"X",
">",
",",
"X",
">",
"fn",
",",... | Perform a flatMapping operation that may catch the supplied Exception types
The supplied Exception types are only applied during this map operation
@param fn flatMapping function
@param classes exception types to catch
@param <R> return type of mapping function
@return Try with result or caught exception | [
"Perform",
"a",
"flatMapping",
"operation",
"that",
"may",
"catch",
"the",
"supplied",
"Exception",
"types",
"The",
"supplied",
"Exception",
"types",
"are",
"only",
"applied",
"during",
"this",
"map",
"operation"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/control/Try.java#L582-L585 |
48,194 | aol/cyclops | cyclops/src/main/java/cyclops/control/Try.java | Try.recoverFor | public Try<T, X> recoverFor(Class<? extends X> t, Function<? super X, ? extends T> fn){
return new Try<T,X>(xor.flatMapLeftToRight(x->{
if (t.isAssignableFrom(x.getClass()))
return Either.right(fn.apply(x));
return xor;
}),classes);
} | java | public Try<T, X> recoverFor(Class<? extends X> t, Function<? super X, ? extends T> fn){
return new Try<T,X>(xor.flatMapLeftToRight(x->{
if (t.isAssignableFrom(x.getClass()))
return Either.right(fn.apply(x));
return xor;
}),classes);
} | [
"public",
"Try",
"<",
"T",
",",
"X",
">",
"recoverFor",
"(",
"Class",
"<",
"?",
"extends",
"X",
">",
"t",
",",
"Function",
"<",
"?",
"super",
"X",
",",
"?",
"extends",
"T",
">",
"fn",
")",
"{",
"return",
"new",
"Try",
"<",
"T",
",",
"X",
">",... | Recover if exception is of specified type
@param t Type of exception to fold against
@param fn Recovery function
@return New Success if failure and types fold / otherwise this | [
"Recover",
"if",
"exception",
"is",
"of",
"specified",
"type"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/control/Try.java#L735-L741 |
48,195 | aol/cyclops | cyclops/src/main/java/cyclops/control/Try.java | Try.withCatch | @SafeVarargs
public static <T, X extends Throwable> Try<T, X> withCatch(final CheckedSupplier<T, X> cf, final Class<? extends X>... classes) {
Objects.requireNonNull(cf);
try {
return Try.success(cf.get());
} catch (final Throwable t) {
if (classes.length == 0)
... | java | @SafeVarargs
public static <T, X extends Throwable> Try<T, X> withCatch(final CheckedSupplier<T, X> cf, final Class<? extends X>... classes) {
Objects.requireNonNull(cf);
try {
return Try.success(cf.get());
} catch (final Throwable t) {
if (classes.length == 0)
... | [
"@",
"SafeVarargs",
"public",
"static",
"<",
"T",
",",
"X",
"extends",
"Throwable",
">",
"Try",
"<",
"T",
",",
"X",
">",
"withCatch",
"(",
"final",
"CheckedSupplier",
"<",
"T",
",",
"X",
">",
"cf",
",",
"final",
"Class",
"<",
"?",
"extends",
"X",
"... | Try to execute supplied Supplier and will Catch specified Excpetions or java.lang.Exception
if none specified.
@param cf CheckedSupplier to recover to execute
@param classes Exception types to catch (or java.lang.Exception if none specified)
@return New Try | [
"Try",
"to",
"execute",
"supplied",
"Supplier",
"and",
"will",
"Catch",
"specified",
"Excpetions",
"or",
"java",
".",
"lang",
".",
"Exception",
"if",
"none",
"specified",
"."
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/control/Try.java#L853-L870 |
48,196 | aol/cyclops | cyclops/src/main/java/cyclops/control/Try.java | Try.runWithCatch | @SafeVarargs
public static <X extends Throwable> Try<Void, X> runWithCatch(final CheckedRunnable<X> cf, final Class<? extends X>... classes) {
Objects.requireNonNull(cf);
try {
cf.run();
return Try.success(null);
} catch (final Throwable t) {
if (classes.... | java | @SafeVarargs
public static <X extends Throwable> Try<Void, X> runWithCatch(final CheckedRunnable<X> cf, final Class<? extends X>... classes) {
Objects.requireNonNull(cf);
try {
cf.run();
return Try.success(null);
} catch (final Throwable t) {
if (classes.... | [
"@",
"SafeVarargs",
"public",
"static",
"<",
"X",
"extends",
"Throwable",
">",
"Try",
"<",
"Void",
",",
"X",
">",
"runWithCatch",
"(",
"final",
"CheckedRunnable",
"<",
"X",
">",
"cf",
",",
"final",
"Class",
"<",
"?",
"extends",
"X",
">",
"...",
"classe... | Try to execute supplied Runnable and will Catch specified Excpetions or java.lang.Exception
if none specified.
@param cf CheckedRunnable to recover to execute
@param classes Exception types to catch (or java.lang.Exception if none specified)
@return New Try | [
"Try",
"to",
"execute",
"supplied",
"Runnable",
"and",
"will",
"Catch",
"specified",
"Excpetions",
"or",
"java",
".",
"lang",
".",
"Exception",
"if",
"none",
"specified",
"."
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/control/Try.java#L881-L900 |
48,197 | aol/cyclops | cyclops-rxjava2-integration/src/main/java/cyclops/companion/rx2/Singles.java | Singles.anyOf | public static <T> Single<T> anyOf(Single<T>... fts) {
return Single.fromPublisher(Future.anyOf(futures(fts)));
} | java | public static <T> Single<T> anyOf(Single<T>... fts) {
return Single.fromPublisher(Future.anyOf(futures(fts)));
} | [
"public",
"static",
"<",
"T",
">",
"Single",
"<",
"T",
">",
"anyOf",
"(",
"Single",
"<",
"T",
">",
"...",
"fts",
")",
"{",
"return",
"Single",
".",
"fromPublisher",
"(",
"Future",
".",
"anyOf",
"(",
"futures",
"(",
"fts",
")",
")",
")",
";",
"}"
... | Select the first Single to complete
@see CompletableFuture#anyOf(CompletableFuture...)
@param fts Singles to race
@return First Single to complete | [
"Select",
"the",
"first",
"Single",
"to",
"complete"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-rxjava2-integration/src/main/java/cyclops/companion/rx2/Singles.java#L100-L103 |
48,198 | aol/cyclops | cyclops-rxjava2-integration/src/main/java/cyclops/companion/rx2/Singles.java | Singles.forEach | public static <T, R1, R> Single<R> forEach(Single<? extends T> value1,
Function<? super T, Single<R1>> value2,
BiFunction<? super T, ? super R1, ? extends R> yieldingFunction) {
Single<R> res = value1.flatMap(in -> {
... | java | public static <T, R1, R> Single<R> forEach(Single<? extends T> value1,
Function<? super T, Single<R1>> value2,
BiFunction<? super T, ? super R1, ? extends R> yieldingFunction) {
Single<R> res = value1.flatMap(in -> {
... | [
"public",
"static",
"<",
"T",
",",
"R1",
",",
"R",
">",
"Single",
"<",
"R",
">",
"forEach",
"(",
"Single",
"<",
"?",
"extends",
"T",
">",
"value1",
",",
"Function",
"<",
"?",
"super",
"T",
",",
"Single",
"<",
"R1",
">",
">",
"value2",
",",
"BiF... | Perform a For Comprehension over a Single, accepting a generating function.
This results in a two level nested internal iteration over the provided Singles.
<pre>
{@code
import static cyclops.companion.reactor.Singles.forEach;
forEach(Single.just(1),
a-> Single.just(a+1),
Tuple::tuple)
}
</pre>
@param value1 top l... | [
"Perform",
"a",
"For",
"Comprehension",
"over",
"a",
"Single",
"accepting",
"a",
"generating",
"function",
".",
"This",
"results",
"in",
"a",
"two",
"level",
"nested",
"internal",
"iteration",
"over",
"the",
"provided",
"Singles",
"."
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-rxjava2-integration/src/main/java/cyclops/companion/rx2/Singles.java#L314-L329 |
48,199 | aol/cyclops | cyclops-rxjava2-integration/src/main/java/cyclops/companion/rx2/Singles.java | Singles.fromIterable | public static <T> Single<T> fromIterable(Iterable<T> t) {
return Single.fromPublisher(Future.fromIterable(t));
} | java | public static <T> Single<T> fromIterable(Iterable<T> t) {
return Single.fromPublisher(Future.fromIterable(t));
} | [
"public",
"static",
"<",
"T",
">",
"Single",
"<",
"T",
">",
"fromIterable",
"(",
"Iterable",
"<",
"T",
">",
"t",
")",
"{",
"return",
"Single",
".",
"fromPublisher",
"(",
"Future",
".",
"fromIterable",
"(",
"t",
")",
")",
";",
"}"
] | Construct a Single from Iterable by taking the first value from Iterable
@param t Iterable to populate Single from
@return Single containing first element from Iterable (or empty Single) | [
"Construct",
"a",
"Single",
"from",
"Iterable",
"by",
"taking",
"the",
"first",
"value",
"from",
"Iterable"
] | 59a9fde30190a4d1faeb9f6d9851d209d82b81dd | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-rxjava2-integration/src/main/java/cyclops/companion/rx2/Singles.java#L396-L398 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.