Accumulates the elements of stream into a new Set.
@param stream the Stream
@param <T> the type of element
@return a new {@code java.util.Set} instance
506995
public static <T> Set<T> toSet(Stream<T> stream) {
        return stream.collect(Collectors.<T>toSet());
    }
66560
public void setInputStream(InputStream stream) {
        try {
            cachedInputStream = new ByteArrayOutputStream();
            IOUtils.copy(stream, cachedInputStream);
        } catch (IOException e) {
            LOG.error("Exception on writing InputStream.", e);
        }
    }
1002662
public static <K, V> Stream<Entry<K, V>> buildEntryStream(Map<K, V> map) {
        return map.entrySet().stream();
    }
908367
@Override
    public <T extends Event> Stream<T> createStream(String name, KeyFinder<T> finder, ProcessingElement... processingElements) {
        return super.createStream(name, finder, processingElements);
    }
1333418
function addToStream(stream) {
  // Don't add more than once
  if (stream.listeners('addListener').includes(addListener)) {
    return stream;
  }

  stream.on('newListener', addListener);

  return stream;
}
475967
public static <T> Stream<T> stream(final Iterable<T> source) {
        return new Stream<T>() {
            @Override
            public Iterator<T> iterator() {
                return source.iterator();
            }
        };
    }
37990
public static <T> T getLast(@javax.annotation.Nonnull final Stream<T> stream) {
    final List<T> collect = stream.collect(Collectors.toList());
    final T last = collect.get(collect.size() - 1);
    return last;
  }
694424
public static <T> Stream<T> stream(Stream<T> stream, boolean parallel) {
        if(parallel) {
            return stream.parallel();
        }
        else {
            return stream.sequential();
        }
    }
521613
public static Stream<Element> stream(Element element) {
        return StreamSupport.stream(new ElementParentsIterable(element).spliterator(), false);
    }
878652
public static Map<String, Object> read(InputStream stream)
		throws IOException
	{
		ConfigJsonInput input = new ConfigJsonInput(new InputStreamReader(stream, StandardCharsets.UTF_8));
		return read(input);
	}
844571
public static <T> Collector<T, List<T>> toList() {
    return new Collector<T, List<T>>() {
      @Override
      public List<T> collect(Stream<? extends T> stream) {
        return Lists.newArrayList(stream.iterator());
      }
    };
  }
612125
public <U> BaseSimpleReactStream<U> from(final DoubleStream stream) {

        return (BaseSimpleReactStream<U>) from(stream.boxed());

    }
1150862
public static <K, V> EntryStream<K, V> of(Stream<? extends Entry<K, V>> stream) {
        if (stream instanceof AbstractStreamEx) {
            @SuppressWarnings("unchecked")
            AbstractStreamEx<Entry<K, V>, ?> ase = (AbstractStreamEx<Entry<K, V>, ?>) stream;
            if (ase.spliterator != null)
                return new EntryStream<>(ase.spliterator(), ase.context);
            return new EntryStream<>(ase.stream(), ase.context);
        }
        return new EntryStream<>(stream, StreamContext.of(stream));
    }
109855
public static <T, R> Map<R, List<T>> groupBy(Stream<T> stream,
            Function<T, R> classifier) {
        return stream.collect(groupingBy(classifier));
    }
427945
public void addStream(Stream stream) {
        indexSets.add(stream.getIndexSet());
        if (streams.add(stream)) {
            sizeCounter.inc(8);
            if (LOG.isTraceEnabled()) {
                LOG.trace("[Message size update][{}] stream added: {}", getId(), sizeCounter.getCount());
            }
        }
    }
854354
public static <T, K, V> Map<K, V> toMap( Stream<T> stream, Function<T, K> keySupplier, Function<T, V> valueSupplier ) {
        return stream.collect(Collectors.toMap(keySupplier, valueSupplier));
    }
1179928
public Configuration create(InputStream stream) {
        try {
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            factory.setValidating(false);
            factory.setIgnoringElementContentWhitespace(true);
            factory.setNamespaceAware(true);
            DocumentBuilder documentBuilder = factory.newDocumentBuilder();
            Document document = documentBuilder.parse(stream);
            return domConfigurationFactory.create(document);
        } catch (ParserConfigurationException e) {
            throw new TextProcessorFactoryException(e);
        } catch (IOException e) {
            throw new TextProcessorFactoryException(e);
        } catch (SAXException e) {
            throw new TextProcessorFactoryException(e);
        }
    }