arraylist Questions

5

Solved

I'm been assigned to make a program that gets 100 random integers between 0-25 and store them in an array. I then have to call upon 2 methods to split the evens and the odds (very typical). So I tr...
Rubbery asked 18/10, 2012 at 5:38

6

Solved

I have two String arrays. One having short name. // days short name String[] shortNames = {"SUN", "MON", "...", "SAT"}; The other having long name. // days long name String[] longNames = {"SUND...
Gehring asked 20/5, 2015 at 3:16

7

Solved

What is the difference between .size() and .length ? Is .size() only for arraylists and .length only for arrays?
Girlfriend asked 25/11, 2013 at 12:15

7

Solved

Suppose I have an ArrayList of objects of size n. Now I want to insert an another object at specific position, let's say at index position k (is greater than 0 and less than n) and I want other obj...
Wembley asked 16/8, 2011 at 6:34

12

Solved

I have an array which carry some integer numbers. Say,numbers={3,0,1} or say, numbers={9,6,4,2,3,5,7,0,1}. Now I have to find out the missing numbers from the array. As per this example there is on...
Eth asked 17/12, 2018 at 22:1

14

Solved

How do I create an ArrayList with integer and string input types? If I create one as: List<Integer> sections = new ArrayList <Integer>(); that will be an Integer type ArrayList. If ...
Timothy asked 26/10, 2013 at 3:50

9

Solved

I would like to do something like this: private ArrayList<String[]> addresses = new ArrayList<String[3]>(); This does not seem to work. Whats the easiest way of storing multiple addr...
Attainder asked 17/12, 2009 at 11:39

18

Solved

I have an ArrayList, which I want to divide into smaller List objects of n size, and perform an operation on each. My current method of doing this is implemented with ArrayList objects in Java. Any...
Byers asked 28/4, 2011 at 20:49

21

Solved

I am wanting to create an array of arraylist like below: ArrayList<Individual>[] group = new ArrayList<Individual>()[4]; But it's not compiling. How can I do this?
Singhalese asked 19/12, 2011 at 9:9

25

Solved

I have a basic question on Java ArrayList. When ArrayList is declared and initialized using the default constructor, memory space for 10 elements is created. Now, when I add an 11th element, what h...
Gerick asked 15/12, 2010 at 13:53

8

Solved

I'm looking at the problem: Write a program which reads a sequence of integers and displays them in ascending order. I'm creating an ArrayList (which I am new to) and I want to populate with inte...
Fraise asked 21/8, 2012 at 13:43

9

Solved

My logic is messed up. I am just trying to work out a way to remove duplicates in an ArrayList without using a HashSet. public static void main(String[] args) { ArrayList<String> wordDulica...
Duffey asked 2/10, 2012 at 19:46

5

Solved

I want to create, in Java code, a custom pagination by an array list: import org.springframework.data.domain.Sort; import org.springframework.data.domain.PageRequest; import org.springframework.dat...
Bonaparte asked 16/10, 2015 at 13:14

7

Solved

So, normally ArrayList.toArray() would return a type of Object[]....but supposed it's an Arraylist of object Custom, how do I make toArray() to return a type of Custom[] rather than Object[]?
Britisher asked 21/2, 2011 at 2:7

28

I have implemented the spinner by populating the array list through database.I can get and show the array list in my spinner array adapter but if I select the item in spinner it does not shown in s...
Derosier asked 3/12, 2013 at 14:52

23

Solved

How can I split an ArrayList (size=1000) in multiple ArrayLists of the same size (=10) ? ArrayList<Integer> results;
Trunk asked 24/5, 2010 at 7:11

1

I am comparing the two list to find the differences between them using a custom implementation DiffUtil Callback but those two list have different size and when i logged the elements being compared...
Dunne asked 8/7, 2017 at 6:31

9

Solved

I want to write an ArrayList<String> into a text file. The ArrayList is created with the code: ArrayList arr = new ArrayList(); StringTokenizer st = new StringTokenizer( line, ":Mode set...
Hickey asked 1/7, 2011 at 12:48

6

Solved

I want to get pairs of objects from an ArrayList so I can perform calculations between the elements of each object. Ideally it should iterate over pairs of objects. For example in a List with {obj1...
Bellwether asked 4/7, 2015 at 14:56

3

Solved

If we have a Type[], we can only store Type or its subtypes in it. The same goes for ArrayList. So why is it said that one is homogeneous while the other is not?
Microtome asked 18/4, 2016 at 17:24

6

Solved

I want to create a Arraylist which should contain Integers and Strings.. Is that possible? I have created two Arraylist as given below: ArrayList<Integer> intList=new ArrayList<Integer&g...
Vennieveno asked 3/8, 2013 at 13:19

7

Solved

Can you explain me why does this happen and how can I fix it please? So I'm using Oracle-ADF and I'm using shuttle components. I get the selected values using the sos1.getValue(); The getValue() me...
Goatfish asked 4/3, 2015 at 10:8

8

Solved

I was wondering how to initialise an integer array such that it's size and values change through out the execution of my program, any suggestions?
Humiliate asked 11/3, 2010 at 16:22

2

When reading through the OpenJDK code for class ArrayList, for instance, in JDK17 (https://github.com/openjdk/jdk17/blob/master/src/java.base/share/classes/java/util/ArrayList.java) I stumbled up...
Indiction asked 29/11, 2023 at 22:55

4

Solved

How can we get the last added element in ArrayList. I find this that explain how to get the last element, but is the last added element always the last element ?
Knorring asked 19/9, 2012 at 10:14

© 2022 - 2025 — McMap. All rights reserved.