Browsing Category:Java

Java, Programming

How To Remove an Element From An Array Java 8

String[] array = new String[]{ "1", "2", "3" };String[] output1 = Arrays.stream(array).skip(1).toArray(String[]::new);String[] output2 = Arrays.stream(array).limit(2).toArray(String[]::new);String[] output3 = Arrays.stream(array).skip(1).limit(1).toArray(String[]::new);System.out.println(String.join(", ", output1));System.out.println(String.join(", ", output2));System.out.println(String.join(", ", output3));Output:2,...
Continue reading
Share