Exemplo n.º 1
0
//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.LongStream toLongStream(Object list)
        public static LongStream ToLongStream(object list)
        {
            if (list == null)
            {
                return(LongStream.empty());
            }
            else if (list is SequenceValue)
            {
                throw new System.ArgumentException("Need to implement support for SequenceValue in CompiledConversionUtils.toLongStream");
            }
            else if (list is System.Collections.IList)
            {
                return(((System.Collections.IList)list).Select(n => (( Number )n).longValue()));
            }
            else if (list.GetType().IsAssignableFrom(typeof(object[])))
            {
                return(java.util.( object[] )list.Select(n => (( Number )n).longValue()));
            }
            else if (list is sbyte[])
            {
                sbyte[] array = ( sbyte[] )list;
                return(IntStream.range(0, array.Length).mapToLong(i => array[i]));
            }
            else if (list is short[])
            {
                short[] array = ( short[] )list;
                return(IntStream.range(0, array.Length).mapToLong(i => array[i]));
            }
            else if (list is int[])
            {
                return(IntStream.of(( int[] )list).mapToLong(i => i));
            }
            else if (list is long[])
            {
                return(LongStream.of(( long[] )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));
        }
Exemplo n.º 2
0
 private string InitialHosts(int[] clusterPorts)
 {
     return(IntStream.of(clusterPorts).mapToObj(i => "127.0.0.1:" + i).collect(Collectors.joining(",")));
 }
 public virtual void test_of_stream()
 {
     assertContent(IntArray.of(IntStream.empty()));
     assertContent(IntArray.of(IntStream.of(1, 2, 3)), 1, 2, 3);
 }
Exemplo n.º 4
0
 private IntStream PropertyKeyIds(IndexPopulation population)
 {
     return(IntStream.of(population.Schema().PropertyIds));
 }
Exemplo n.º 5
0
 public virtual Stream <CountResult> Stream123()
 {
     return(IntStream.of(1, 2, 3).mapToObj(i => new CountResult(i, "count" + i)));
 }