Skip to Main Content

How to remove specific element in two dimensional array ?

Arasu DhanushMay 25 2016 — edited May 26 2016

Have some queries regarding on two dimensional array.

For example :

                         Object[][] objectArray = new Object[][]{{ 1.0D,2.0D,3.0D},{ 4.0D,5.0D,6.0D},{ 7.0D,8.0D,9.0D}};

                         Object[][] copyObjectArray = Arrays.stream(objectArray).map(x -> x.clone()).limit(2).toArray(Object[][]::new);

                         System.out.println(Arrays.deepToString(copyObjectArray));

     The above snippet returns the output like [[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]] because it's limit two rows.

     Is there any function two remove column or limit the column using Java 8 lamda function ?.

     Awaiting for your response.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked due to inactivity on Jun 23 2016
Added on May 25 2016
3 comments
924 views