34,591 questions
-3
votes
0
answers
95
views
I am getting ArrayIndexOutOfBoundException while using the below code [closed]
I am getting ArrayIndexOutOfBoundException while checking thread safety of ArrayList. We are getting exception.We are getting exception after that we are getting the output but while using vector we ...
3
votes
3
answers
218
views
ArrayList vs LinkedList in terms of cache locality
How does cache locality impact the performance of ArrayList compared to LinkedList in Java?
I've often heard that ArrayList has an advantage in terms of cache locality, but I don't fully understand ...
0
votes
1
answer
60
views
Backtracking confusion
Concerning Javascript, I've been trying to understand backtracking lately and it's really confusing. Specifically, I've been trying to understand the permutation problem, which when given an array, we ...
3
votes
2
answers
159
views
How to retrieve individual arrays from arrays of strings stored inside an ArrayList?
I'm working on an assignment where I need to take "books" from the user(a title, an author, and ISBN number, all strings), and store these books somehow, and then do various things to these ...
1
vote
1
answer
40
views
LINQ Query to find items that contain a value in an array of values
I have a text property in a class that will contain multiple words along with other properties (index, linenumber, starttime, endtime). I have an arraylist (rawdata) of that class built.
I need to be ...
1
vote
1
answer
51
views
Java with Playwright onResponse method - can't get returned String value, IndexOutOfBoundsException
I have created a void method which prints out the required responses from an url (using Java and Playwright) but I actually need to receive these values for making junit assertions and I am trying to ...
2
votes
3
answers
217
views
What does this piece of code mean? new ArrayList<>(Collections.emptyList())
In some code from my company, I've read a list initialization:
List<SomeClass> someClassList = new ArrayList<>(Collections.emptyList())
What does it mean? A list with 0 size ...
0
votes
1
answer
54
views
Stack Overflow on Quicksort with a first element pivot in Java
For this assignment I'm supposed to test my quicksort class using a variety of different pivots and a variety of ArrayLists in different arrangements. The class works fine with a random pivot, or a ...
2
votes
3
answers
86
views
How to check if the user has purchased the maximum capacity?
I have a Java code for booking movie tickets. In this program, each person can only buy two tickets, a maximum of 10 tickets are sold and at the end it displays a list with the names of the people. I ...
0
votes
0
answers
43
views
Drools - Pulling an ArrayList<String> from a HashMap<String, Object> in drools
For the life of me I cannot pull a simple String ArrayList from my generic hashmap: HashMap<String, Object>
I have been able to pull much more complicated structures such as List of objects ...
1
vote
4
answers
138
views
Accessing an array variable by "concatenating" root variable name + int [duplicate]
A total Java rookie here, I'm wondering if there's any way I could iterate over several arrays like:
myArray1
myArray2
myArray3
by doing some form of "concatenation" to invoke these arrays ...
1
vote
2
answers
72
views
Sort a multidimensional array/arraylist/hashtable
Currently I have the below code creating a multidimensional arraylist (but I am not married using arraylists, just need a free-to-add to array type):
$Installs = new-object system.collections....
0
votes
0
answers
28
views
Read in bitmaps from file arraylist to bitmap arraylist [duplicate]
How do I extract image urls from a file arraylist and add the corresponding bitmap to a bitmap arraylist. I've blocked out what I think is close:
val fileList: ArrayList<File> = imageReaderNew(...
0
votes
0
answers
22
views
How do i resolve this index out of range issue?
I did multiple times fixing this problem, i also ask for help from ChatGPT, but its still not fixed. I crawl everywhere looking for this fix. I will attach the code down below, so you can see the code:...
0
votes
0
answers
24
views
list - filter condition working in one scenario but not another
I have two arrays both contain 12 elements. I want capture the elements with the indexes of 0, 5, 10 and store them in a new variable, but I've noticed my filtering does not work if I change some of ...