public virtual void coverage() { MapStream.empty().filter(e => false).distinct().sorted().sorted((e1, e2) => 0).peek(e => e.ToString()).limit(0).skip(0).sequential().parallel().unordered().onClose(() => Console.WriteLine()).close(); MapStream.empty().anyMatch(e => true); MapStream.empty().allMatch(e => true); MapStream.empty().noneMatch(e => true); MapStream.empty().count(); MapStream.empty().findAny(); MapStream.empty().findFirst(); MapStream.empty().max((e1, e2) => 0); MapStream.empty().min((e1, e2) => 0); MapStream.empty().GetEnumerator(); MapStream.empty().spliterator(); MapStream.empty().Parallel; MapStream.empty().map(e => e); MapStream.empty().mapToInt(e => 0); MapStream.empty().mapToLong(e => 0); MapStream.empty().mapToDouble(e => 0); MapStream.empty().flatMap(e => Stream.empty()); MapStream.empty().flatMapToDouble(e => DoubleStream.empty()); MapStream.empty().flatMapToInt(e => IntStream.empty()); MapStream.empty().flatMapToLong(e => LongStream.empty()); MapStream.empty().collect(toList()); MapStream.empty().collect(() => null, (o, e) => Console.WriteLine(), (o1, o2) => Console.WriteLine()); MapStream.empty().toArray(); MapStream.empty().toArray(i => new object[0]); MapStream.empty().forEach(e => Console.WriteLine()); MapStream.empty().forEachOrdered(e => Console.WriteLine()); MapStream.empty().reduce(new AbstractMap.SimpleEntry <>(null, null), (o1, o2) => null); MapStream.empty().reduce((o1, o2) => null); MapStream.empty().reduce(null, (o, e) => null, (o1, o2) => null); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") public static java.util.stream.DoubleStream toDoubleStream(Object list) public static DoubleStream ToDoubleStream(object list) { if (list == null) { return(DoubleStream.empty()); } else if (list is SequenceValue) { throw new System.ArgumentException("Need to implement support for SequenceValue in CompiledConversionUtils.toDoubleStream"); } else if (list is System.Collections.IList) { return(((System.Collections.IList)list).Select(n => (( Number )n).doubleValue())); } else if (list.GetType().IsAssignableFrom(typeof(object[]))) { return(java.util.( object[] )list.Select(n => (( Number )n).doubleValue())); } else if (list is float[]) { float[] array = ( float[] )list; return(IntStream.range(0, array.Length).mapToDouble(i => array[i])); } else if (list is double[]) { return(DoubleStream.of(( double[] )list)); } //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: throw new System.ArgumentException(format("Can not be converted to stream: %s", list.GetType().FullName)); }
/// <summary> /// Runs the double topic client example. /// </summary> /// <param name="cancellationToken">A token used to end the client example.</param> /// <param name="args">A single string should be used for the server url.</param> public async Task Run(CancellationToken cancellationToken, string[] args) { var serverUrl = args[0]; // Connect anonymously var session = Diffusion.Sessions.Open(serverUrl); // Get the Topics feature to subscribe to topics var topics = session.Topics; var topic = "random/Double"; // Add a topic stream for 'random/Double' var doubleStream = new DoubleStream(); topics.AddStream(topic, doubleStream); try { // Subscribe to 'random/Double' topic await topics.SubscribeAsync(topic, cancellationToken); // Run until user requests ending of example await Task.Delay(Timeout.Infinite, cancellationToken); } catch (TaskCanceledException) { //Task was canceled; close stream and unsubscribe topics.RemoveStream(doubleStream); await topics.UnsubscribeAsync(topic); } finally { // Note that closing the session, will automatically unsubscribe from all topics the client is // subscribed to. session.Close(); } }
public LocalDateDoubleTimeSeries mapValues(System.Func <double, double> mapper) { ArgChecker.notNull(mapper, "mapper"); return(createUnsafe(dates_Renamed, DoubleStream.of(values_Renamed).map(mapper).toArray())); }
public DoubleStream values() { return(DoubleStream.of(values_Renamed)); }
public virtual void test_of_stream() { assertContent(DoubleArray.of(DoubleStream.empty())); assertContent(DoubleArray.of(DoubleStream.of(1d, 2d, 3d)), 1d, 2d, 3d); }
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: public static java.util.Set<?> toSet(Object value) public static ISet <object> ToSet(object value) { if (value == null || value == NO_VALUE) { return(Collections.emptySet()); } else if (value is SequenceValue) { SequenceValue sequenceValue = ( SequenceValue )value; IEnumerator <AnyValue> iterator = sequenceValue.GetEnumerator(); ISet <AnyValue> set; if (sequenceValue.IterationPreference() == RANDOM_ACCESS) { // If we have a random access sequence value length() should be cheap and we can optimize the initial capacity int length = sequenceValue.Length(); set = new HashSet <AnyValue>(length); for (int i = 0; i < length; i++) { set.Add(sequenceValue.Value(i)); } } else { set = new HashSet <AnyValue>(); while (iterator.MoveNext()) { AnyValue element = iterator.Current; set.Add(element); } } return(set); } //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: else if (value instanceof java.util.Collection<?>) else if (value is ICollection <object> ) { //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: return new java.util.HashSet<>((java.util.Collection<?>) value); return(new HashSet <object>((ICollection <object>)value)); } else if (value is LongStream) { LongStream stream = ( LongStream )value; return(stream.boxed().collect(Collectors.toSet())); } else if (value is IntStream) { IntStream stream = ( IntStream )value; return(stream.boxed().collect(Collectors.toSet())); } else if (value is DoubleStream) { DoubleStream stream = ( DoubleStream )value; return(stream.boxed().collect(Collectors.toSet())); } else if (value.GetType().IsArray) { int len = Array.getLength(value); HashSet <object> collection = new HashSet <object>(len); for (int i = 0; i < len; i++) { collection.Add(Array.get(value, i)); } return(collection); } throw new CypherTypeException("Don't know how to create a set out of " + value.GetType().Name, null); }