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...
7
Solved
What is the difference between .size() and .length ? Is .size() only for arraylists and .length only for arrays?
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...
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...
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 ...
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...
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?
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...
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...
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[]?
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...
23
Solved
How can I split an ArrayList (size=1000) in multiple ArrayLists of the same size (=10) ?
ArrayList<Integer> results;
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...
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...
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...
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...
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?
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 ?
1 Next >
© 2022 - 2025 — McMap. All rights reserved.