Skip to content

Tag Archives: Java-Arrays

The java.lang.reflect.Array.getShort() is an in-built method of Array class in Java and is used to return the element present at a given index from the… Read More
The java.lang.reflect.Array.getChar() is an inbuilt method in Java and is used to return the element present at a given index from the specified Array as… Read More
The java.lang.reflect.Array.getBoolean() returns the given index from the specified Array as a short. Syntax: Array.getBoolean(Object []array,int index) Parameters: array: The object array whose index is… Read More
The java.lang.reflect.Array.getByte() is an inbuilt method in Java and is used to return the element present at the given index from the specified Array as… Read More
The java.lang.reflect.Array.get() is an inbuilt method in Java and is used to return the element at a given index from the specified Array. Syntax Array.get(Object… Read More
The java.lang.reflect.Array.getInt() is an inbuilt method in Java and is used to return an element at the given index from the specified Array as a… Read More
An Array is a collection of elements which can be of either primitive datatypes or objects. Arrays in Java are static in nature. ArrayLists, on… Read More
We have discussed that an array of ArrayList is not possible without warning. A better idea is to use ArrayList of ArrayList. // Java code… Read More
We often come across 2D arrays where most of the part in the array is empty. Since space is a huge problem, we try different… Read More
There are two in-built methods to sort in Java. Arrays.Sort() works for arrays which can be of primitive data type also. // A sample Java… Read More
Given an array of integers arr[], find the number of recycled pairs in the array. A recycled pair of two numbers {a, b} has the… Read More
Prerequisite:   Arrays in Java Collection in Java Below are some of the differences between Arrays and Collection:    Arrays Collection Arrays are fixed in size… Read More
Prerequisite : Stream In Java Using Arrays.stream() : Syntax : public static <T> Stream<T> getStream(T[] arr) { return Arrays.stream(arr); } where, T represents generic type.… Read More
Given a 2D array, sort each row of this array and print the result.Examples:  Input : 77 11 22 3 11 89 1 12 32… Read More