Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

get subarray of String java Streams

import java.util.Arrays;
import java.util.stream.IntStream;
 
class Main
{
    // Get subarray of a non-primitive array between specified indices
    public static void main(String[] args)
    {
        String[] arr = { "A", "B", "C", "D", "E", "F", "G", "H" };
        int beg = 1, end = 4;
 
        String[] subarray = IntStream.range(beg, end + 1)
                                .mapToObj(i -> arr[i])
                                .toArray(String[]::new);
 
        System.out.println(Arrays.toString(subarray));
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: How can i stub Instant object using powermock 
Java :: Spring AOP 
Java :: usaco 2018 january contest 
Java :: Example of ArrayDeque 
Java :: cannot write data document seems to have been closed already in java 
Java :: react native appearance.addchangelistener android 
Java :: ordenar mapa de forma descendente java 
Java :: java ternärer operator 
Java :: tutorialedge working with docker 
Java :: system.out.print 
Java :: java filter list of dupllicate netries 
Java :: origin model color 
Java :: kubernetes java client create namespace 
Java :: Recyclerview scramble after scrolling 
Java :: convert kotlin to java online editor 
Java :: how to validate information against the database in java 
Java :: compare time in java 
Java :: what is method overriding in java 
Java :: method in java 
Java :: || in java 
Java :: how to check if array is full java 
Java :: java stream group by multiple fields 
Java :: can you use java in unity 
Java :: thymeleaf spring boot dependency for mail 
Java :: /bin/sh 1 java not found docker 
Java :: selenium firefox to foreground -python java 
Sql :: mysql set max connections 
Sql :: GROUP BY clause; this is incompatible with sql_mode=only_full_group_by 
Sql :: SQL order random 
Sql :: select duplicates in sql 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =