Java Code Examples for io.vavr.collection.Stream#ofAll()
The following examples show how to use
io.vavr.collection.Stream#ofAll() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VavrSampler.java From tutorials with MIT License | 6 votes |
public static void vavrStreamManipulation() { System.out.println("Vavr Stream Manipulation"); System.out.println("===================================="); List<String> stringList = new ArrayList<>(); stringList.add("foo"); stringList.add("bar"); stringList.add("baz"); Stream<String> vavredStream = Stream.ofAll(stringList); vavredStream.forEach(item -> System.out.println("Vavr Stream item: " + item)); Stream<String> vavredStream2 = vavredStream.insert(2, "buzz"); vavredStream2.forEach(item -> System.out.println("Vavr Stream item after stream addition: " + item)); stringList.forEach(item -> System.out.println("List item after stream addition: " + item)); Stream<String> deletionStream = vavredStream.remove("bar"); deletionStream.forEach(item -> System.out.println("Vavr Stream item after stream item deletion: " + item)); }
Example 2
Source File: VavrSampler.java From tutorials with MIT License | 6 votes |
public static void vavrStreamManipulation() { System.out.println("Vavr Stream Manipulation"); System.out.println("===================================="); List<String> stringList = new ArrayList<>(); stringList.add("foo"); stringList.add("bar"); stringList.add("baz"); Stream<String> vavredStream = Stream.ofAll(stringList); vavredStream.forEach(item -> System.out.println("Vavr Stream item: " + item)); Stream<String> vavredStream2 = vavredStream.insert(2, "buzz"); vavredStream2.forEach(item -> System.out.println("Vavr Stream item after stream addition: " + item)); stringList.forEach(item -> System.out.println("List item after stream addition: " + item)); Stream<String> deletionStream = vavredStream.remove("bar"); deletionStream.forEach(item -> System.out.println("Vavr Stream item after stream item deletion: " + item)); }
Example 3
Source File: VavrSampler.java From tutorials with MIT License | 5 votes |
public static void vavrStreamElementAccess() { System.out.println("Vavr Element Access"); System.out.println("===================================="); Stream<Integer> vavredStream = Stream.ofAll(intArray); System.out.println("Vavr index access: " + vavredStream.get(2)); System.out.println("Vavr head element access: " + vavredStream.get()); Stream<String> vavredStringStream = Stream.of("foo", "bar", "baz"); System.out.println("Find foo " + vavredStringStream.indexOf("foo")); }
Example 4
Source File: VavrSampler.java From tutorials with MIT License | 5 votes |
public static void vavrParallelStreamAccess() { System.out.println("Vavr Stream Concurrent Modification"); System.out.println("===================================="); Stream<Integer> vavrStream = Stream.ofAll(intList); // intList.add(5); vavrStream.forEach(i -> System.out.println("in a Vavr Stream: " + i)); // Stream<Integer> wrapped = Stream.ofAll(intArray); // intArray[2] = 5; // wrapped.forEach(i -> System.out.println("Vavr looped " + i)); }
Example 5
Source File: VavrSampler.java From tutorials with MIT License | 5 votes |
public static void vavrStreamElementAccess() { System.out.println("Vavr Element Access"); System.out.println("===================================="); Stream<Integer> vavredStream = Stream.ofAll(intArray); System.out.println("Vavr index access: " + vavredStream.get(2)); System.out.println("Vavr head element access: " + vavredStream.get()); Stream<String> vavredStringStream = Stream.of("foo", "bar", "baz"); System.out.println("Find foo " + vavredStringStream.indexOf("foo")); }
Example 6
Source File: VavrSampler.java From tutorials with MIT License | 5 votes |
public static void vavrParallelStreamAccess() { try { System.out.println("Vavr Stream Concurrent Modification"); System.out.println("===================================="); Stream<Integer> vavrStream = Stream.ofAll(intList); intList.add(5); vavrStream.forEach(i -> System.out.println("in a Vavr Stream: " + i)); } catch (Exception ex) { ex.printStackTrace(); } Stream<Integer> wrapped = Stream.ofAll(intArray); intArray[2] = 5; wrapped.forEach(i -> System.out.println("Vavr looped " + i)); }
Example 7
Source File: CollectionsInteroperabilityUnitTest.java From tutorials with MIT License | 5 votes |
@Test public void givenParams_whenJavaStream_thenReturnVavrListUsingOfAll() { java.util.stream.Stream<String> javaStream = Arrays.asList("Java", "Haskell", "Scala") .stream(); Stream<String> vavrStream = Stream.ofAll(javaStream); assertTrue(vavrStream instanceof io.vavr.collection.Stream); }
Example 8
Source File: HeteroDescribableConfigurator.java From configuration-as-code-plugin with MIT License | 4 votes |
private Stream<String> getSymbols(Descriptor<T> descriptor) { return Stream.ofAll(DescribableAttribute.getSymbols(descriptor, target, target)); }
Example 9
Source File: StreamTest.java From vavr-jackson with Apache License 2.0 | 4 votes |
@Override protected Seq<?> of(Object... objects) { return Stream.ofAll(Arrays.asList(objects)); }