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 :: static method in non static class java 
Java :: authentication in spring boot 
Java :: string cannot be resolved to a type eclipse 
Java :: properties object using a file 
Java :: camunda 
Java :: java string class 
Java :: Java float Keyword 
Java :: minecraft addlayer(u) in the type rendererlivingentity<t is not applicable for the arguments 
Java :: combobox index out of bound javafx 
Java :: Java try...finally block 
Java :: convert code from kotlin to java 
Java :: spring aop xml definition 
Java :: md5 java ee 
Java :: java transformar string a url 
Java :: how to find poiwer in java 
Java :: Marging ViewPager 
Java :: find the key that has the least value in map java 
Java :: how to create arraylist in java 
Java :: no main attribute in java android 
Java :: format string precision double java 
Java :: Person[] people = in java 
Java :: force_dark_auto android webview 
Java :: java mongodb document get 
Java :: code to close dialog containg layout 
Java :: java enum valueof() 
Java :: java preprocessor example 
Java :: public static void main(String args[]) { level input=new level(System.in); FirstPractice obj1=new FirstPractice(); obj1.loosing(1000); } 
Java :: signed and unsigned data types in java 
Java :: how to get single value from input string in java 
Java :: return vs break 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =