DSA Java methods

Arrays:
int[] arr = new int[size];
int[] numbers = {1, 2, 3, 4, 5};
int[][] matrix = {
{1, 2, 3},
{4, 5, 6},
{7, 8, 9}
};
for( int num : nums)
.length

Strings:
.toCharArray()

Hashmap:
Map<Character, Integer> count = new HashMap<>();
.getOrDefault(x, 0)
.values()
.put(key,value)
.size()

Leave a Reply