Skip to content

Commit

Permalink
Create ArrayList_x_array.java
Browse files Browse the repository at this point in the history
  • Loading branch information
sandeepjindal authored Sep 15, 2024
1 parent 9a1dc7d commit 2fce2cb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions common_syntax/java/ArrayList_x_array.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// arraylist to int[]
arrayList.stream().mapToInt(Integer::intValue).toArray();

// int[] -> arrayList
List<Integer> arrayList = Arrays.stream(intArray).boxed().collect(ArrayList::new, ArrayList::add, ArrayList::addAll);

0 comments on commit 2fce2cb

Please sign in to comment.