Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java list of arrays

import java.util.*;

public class ListofArrays {
	public static void main(String []args)
	{
		List<Integer[]> list;
		list = new ArrayList<Integer[]>();

		// Let us create 2 arrays of type Integer

		Integer [] arr1 = new Integer[5];
		Integer [] arr2 = new Integer[5];
		//arr1 stores numbers from 0 to 4
		//arr2 stores the numbers from 5 to 9
		for(int i=0;i<5;i++)
		{
			arr1[i] = i;
		}
		for(int i=0;i<5;i++)
		{
			arr2[i] = i+5;
		}
		//adding both arrays to list
		list.add(arr1);
		list.add(arr2);
		//print elements of the list
		for(int i=0;i<list.size();i++)
		{
			Integer [] arr = list.get(i);
			for(int j=0;j<arr.length;j++)
			{
				System.out.print(arr[j]+ " ");
			}
			System.out.println();
		}
	}
}
Comment

list of arrays java

List<int[]> A = new List<int[]>();
Comment

list of arrays

List<Object[]> list = new ArrayList<>();
list.add(new String[5]);
list.add(new Integer[5]);
Object[] objects = list.get(0);
Comment

PREVIOUS NEXT
Code Example
Java :: how to scan as a letter in java 
Java :: center textview programmatically android 
Java :: java combobox get selected item 
Java :: java turn string into int 
Java :: Java Sorting Using sort() 
Java :: define an array of size n in java 
Java :: Java loop throug gson JsonElement 
Java :: Java program to print decimal to octal conversion 
Java :: kubectl config kubernetes dashboard 
Java :: palindrome java 
Java :: assert multiple junit 
Java :: cardview implementation 
Java :: Java alt f4 
Java :: java map merge example 
Java :: advantages of exception handling in java 
Java :: Imageview on the bottom left of Imageview android anchor 
Java :: checkc if string is double java 
Java :: convert list of dto to map java 
Java :: how to compare strings java 
Java :: Cannot find a class with the main method. 
Java :: java map create with values 
Java :: first line of java code 
Java :: vscode code formatter cannot format 
Java :: java get class name of object 
Java :: set matrix zeros programming creek 
Java :: add two variables in Java 
Java :: android iterate through radio group java 
Java :: get intersection of two lists java 
Java :: new keyword in java 
Java :: Java Thread Example by implementing Runnable interface 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =