#Java - Code Snippets for '#.Out' - 5 code snippet(s) found |
|
Sample 1. Get all Permutations of List Elements using Apache Commons PermutationIterator | |
|
List<String> list = new ArrayList();
list.add("Washington");
list.add("Nevada");
list.add("California");
PermutationIterator permIterator = new PermutationIterator((Collection) list);
permIterator.forEachRemaining(System.out::print); // prints [Washington, Nevada, California][Washington, California, Nevada][California, Washington, Nevada][California, Nevada, Washington][Nevada, California, Washington][Nevada, Washington, California]
|
|
Like Feedback Permutations of collection elements Permutations of List elements Apache Commons PermutationIterator Iterator Collections .forEachRemaining System.out::print List ArrayList |
|
|
Sample 2. Code Sample / Example / Snippet of org.apache.storm.task.OutputCollector | |
|
public void shouldEmitNothingIfNoObjectHasBeenCountedYetAndTickTupleIsReceived() {
Tuple tickTuple = MockTupleHelpers.mockTickTuple();
RollingCountBolt bolt = new RollingCountBolt();
Map conf = mock(Map.class);
TopologyContext context = mock(TopologyContext.class);
OutputCollector collector = mock(OutputCollector.class);
bolt.prepare(conf, context, collector);
bolt.execute(tickTuple);
verifyZeroInteractions(collector);
}
|
|
Like Feedback org.apache.storm.task.OutputCollector |
|
|
Sample 3. Print all elements of a ListValuedMap ( Apache Commons ) using forEach and System.out::println | |
|
ListValuedMap<String,String> listValuedMap = new ArrayListValuedHashMap();
listValuedMap.put("United States", "Washington");
listValuedMap.put("Canada", "Ottawa");
listValuedMap.put("Canada", "Ottawa");
listValuedMap.put("South Africa", "Pretoria");
listValuedMap.put("South Africa", "Cape Town");
listValuedMap.put("South Africa", "Bloemfontein");
listValuedMap.entries().forEach(System.out::println);
|
|
Like Feedback ListValuedMap apache commons System.out::println collections framework map |
|
|
Sample 4. Code Sample / Example / Snippet of java.io.OutputStream | |
|
public static void generateBundle(ArtifactData data, Map<String, String> additionalHeaders) throws IOException {
OutputStream bundleStream = null;
try {
File dataFile = new File(data.getUrl().toURI());
OutputStream fileStream = new FileOutputStream(dataFile);
bundleStream = new JarOutputStream(fileStream, getBundleManifest(data.getSymbolicName(), data.getVersion(), additionalHeaders));
bundleStream.flush();
} catch (URISyntaxException e) {
throw new IOException();
} finally {
if (bundleStream != null) {
bundleStream.close();
}
}
}
|
|
Like Feedback java.io.OutputStream |
|
|
|
Sample 5. Usage of java.util.stream.Stream | |
|
List<Integer> list1 = Arrays.asList(1, 2);
List<Integer> list2 = Arrays.asList(4, 5);
Stream.of(list1, list1)
.flatMap(list -> list.stream())
.forEach(System.out::println);
|
|
Like Feedback Stream.flatMap System.out::println |
|
|