Questions tagged [arraylist]

1

votes
0

answer
61

Views

Django is changing the order of my Integer List

So I'm facing the following problem. When creating a List of Integers in Android Studio: List myIDs= new ArrayList(); I'm putting the integers (id's) in a given order, with a result of, p.e: myIds = [69, 65, 67] I'm using Retrofit for sending the request to the server: @POST('looks/') @FormUrlEncode...
Daniel Morales
1

votes
1

answer
18

Views

Display two Reclerview in single activty with same recyclerview adapter

I have two List coming from webservice Like past and future.Sometimes both List have data and sometime only one list have data. And how set the differt RecyclerView for pastList and FuturList with same adapter.
Chahat
1

votes
1

answer
54

Views

Grabbing substrings with same start but variable end and lenght in a String an add it to an Array

I'm looking for a way to catch all substrings in a huge String. The substrings are all starting with: 'productName':' , after the quote right behind the colon, the substrings have obviously different endings and length, but they all have a quote like this on their very end: 'productName':'cucumber...
Leo A.
0

votes
0

answer
21

Views

Under what circumstance following code will return 20?

I have following code, and I would like to find out, under what circumstances following code will return 20 instead of 10. private int strComp(String strOne, int strTwo) { ArrayList arrString = new ArrayList(Arrays.asList((strOne + System.lineSeparator()).split('(?
Ganesh Walavalkar
1

votes
2

answer
50

Views

How can I return an Array list value into a separate array?

I am trying to create a program that gets the dot product of two vectors. I approached it by creating an Array List (named distance). I can make this program run with hardcoded numbers by changing this line in the main method. double vect_A[] = distnace(mag); double vect_B[] = distance(dista); I kn...
quad man
1

votes
1

answer
141

Views

Compare content of two lists, Java, Selenium

I'm creating simple grabber in Java for my use. Overall the thing I want to do is: Get all links from main page and check if they are internal Store internal link in a listOld (temporally they are stored in set to avoid duplicated links then saved to list) Visit link from listOld Get all links from...
LVN
1

votes
2

answer
84

Views

Reload data after search on json listview android

I have searched all over StackOverflow trying to solve my problem, but i cant seem to get my filter to work. I'm using a edittext to filter my json listview which is populated using volley, I want to be able to search for my 'titulo' or 'dificuldade' and if I erase the EditText i want to reload the...
Sapo121
1

votes
2

answer
69

Views

How to get a list of objects contained only specific fields in Java?

I have a list of object from type Person: String id String name String address String workPlace I want to create a new list contain Person objects but only with 2 fields: id and name. I want to create a json from that list later that looks like this: [ { 'id': '767384', 'name': 'Bob', }, { 'id': '2...
BD111
1

votes
1

answer
32

Views

Adding Element to Class Array with function. “Paint” in Processing 3

I'm trying to create a 'Paint' application with Processing 3, and I want to add buttons to change the color (later on for brushes, size, etc). I'm stuck because I'm keep getting a NullPointerException for adding the button to my array. (I know i could just ask for the mouseX and Y after creating ev...
Alex
1

votes
1

answer
139

Views

how do you make arraylist from firebase database to populate in ArrayAdapter?

personTypes from database: { key = personTypes, value = {RESIDENT_HOMEOWNER=Resident Homeowner, RESIDENT_VISITOR=Resident Visitor, RESIDENT_RELATIVE=Resident Relative, RESIDENT_TENANT=Resident Tenant, HELPER_OUT=Helper Stay-out, PERSONNEL_1=Personnel 1, MAINTENANCE=Maintenance, PERSONNEL_2=Personnel...
Ina Yano
1

votes
1

answer
33

Views

Adding Views dinamically from an Arraylist

I want to add comments like happens on facebook mobile... My code works for the frist comment, but on the second it crashs. The error message shows that my array has just one elemment, I also tried inicialize the array capacity, but I recive the same error. (Im brazilian, I hope that You're understa...
Valdir
1

votes
2

answer
72

Views

Unable to add int into an ArrayList of ArrayLists

I am trying to make a Radix Sort algorithm and I have an Array List of Array Lists. Radix Sort adds elements to the 'outer' array list depending on the value of a number's one's, ten's, hundred's, etc. place. Each 'inner' array list corresponds to a digit place of 0, 1, 2, 3...9. The value of vari...
Shania
1

votes
1

answer
75

Views

Set with duplicates java - import from file - java

I have a small project. The project imports the txt file to String (coding similar to CSV - contains semicolons = ';'). In the next steps, the String is changed to ArrayList. Then, using Predicate, I remove elements that do not interest me. At the end I replace ArrayList on TreeSet to remove duplica...
1

votes
0

answer
31

Views

Shared ArrayList between socket Java

I have 2 sockets: a client socket (Client class) and a concurrent server socket (ServerC Class) that can handle more clients at same time. The thread server sends an array to the client when it connects. If I update the array inside the thread server, then the program works correctly and the next cl...
1

votes
4

answer
766

Views

No converter found for return value of type: class java.util.ArrayList (Spring Boot)

I am new to Spring Boot and working on database connectivity. All the related classes are here only main class having run method is not posted. It is giving me the error of no converter found for ArrayList. Please help me if I am doing anything wrong. //Customer.java package springbootfirstapp.doma...
Divyani Garg
1

votes
0

answer
108

Views

How to pass arraylist<string> from fragment to fragment

I want to pass ArrayList which is array keys from firebase database. This array is inside OneFragment and I want to send the keys to the TwoFragment. But this gives me error like this : java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.ArrayList android.os.Bundle.getStringA...
Yehezkiel L
1

votes
0

answer
21

Views

How to get the data of a matrix inside an object and visualize them in a RecyclerView?

I'm new to the issue of Android and that question arose, since I do not know how to get the data of an arrangement inside an object This is the data of my web service: {'data':{'categories':[{'id':1,'name':'Whisky','photo':null,'photo_url':null,'created_at':'2018-07-06 17:28:15','updated_at':'2018-0...
Jhosep Bazan
1

votes
1

answer
31

Views

Adding to a List in Android Studio, performance issues

I made this post a few days ago: Issues with a For-Each loop in Android Studio I made the recommended changes of using an Iterator to remove objects from the ArrayList, and the performance issues for removing items stopped. Heres the updated update() method: public void update(){ float elapsedTime =...
Chase Berry
1

votes
0

answer
45

Views

Wierd ArrayList values

Intent: The program is intended to recieve an input from the user and compare it against the contents of the ArrayList. If the input is not found, the program the input to the list and gives it a winCount of 1. The list is printed with the number of wins following it. In the end the user with the hi...
Reece Witcher
1

votes
1

answer
38

Views

Setting actionbar of new activity from mainactivity

this might be trivial, but I still hope you can help me. My MainActivity is a list, where each row consists of an imagebutton on the left side and a text on the right side. Each row has another image and text. When clicking on the button, a new activity opens and I want the actionbar to have the re...
user38601
1

votes
0

answer
54

Views

How to use setImageResource to set a image with ViewHolder

Dose anyone know why setImageResource cannot get image from my getImage method? It gives me and error message saying setImageResource cannot be applied to (jave.lang.string). I've tried changing movieImage value into a Int but it then gives me another list of errors. Should I stick to setImageResou...
Caleb Lee
1

votes
0

answer
31

Views

How to add the result of a quake entry index to a new list?

What is the variable type of quakeData.get(bigIndex)? How do I add quakeData.get(bigIndex) to my new list? I plan on passing a substring with each iteration to find the Largest quake how should I go about that? I have also been using the .add() and it hasn't been working. Also, the x value is incorr...
Eli
1

votes
1

answer
193

Views

Get text from List<WebElement> in Groovy

I am dealing with problem to implement groovy lambda function getting text from List collection into List collection. The original java code: list.stream().map(WebElement::getText).collect(Collectors.toList()); My Groovy version fails: list.stream().map({ WebElement } as String).collect(Collectors....
Michal
1

votes
2

answer
71

Views

Calling ArrayList set method in onChildChanged creates duplicate record with updated record

ArrayList mKeys = new ArrayList(); ArrayList objectItems = new ArrayList(); public void onChildAdded(DataSnapshot dataSnapshot, String s) { String key_use = dataSnapshot.getKey(); mKeys.add(key_use); //some codes objectItems.add(0, objectItem); customListAdapter.notifyDataSetChanged(); } } public vo...
johnson
0

votes
0

answer
6

Views

How to iterate through a CSV file with data organized by collumns to make seperate arrayLists of each collumn?

I have an Excel file that I converted to a CSV and need to make an ArrayList of each column of data. I don't want to manually add each data point. Is there a way to use an iterator to only read in one column at a time and then save that as an ArrayList? I made a method that can read in the whole CS...
GeoJake
1

votes
1

answer
21

Views

Incorporating array into forloop // same pattern

I need some quick help on how to incorporate my array into a forloop. I currently have a graph that takes in this as nodes: var classes = [ {'name':'test.cluster1.item1'}, {'name':'test.cluster1.item2'}, {'name':'test.cluster1.item3'} ]; I have a separate working array called fileArray which I have...
Akshay
1

votes
3

answer
80

Views

Writing File in java with Array List but not working [duplicate]

This question already has an answer here: How do I create a file and write to it in Java? 30 answers It seems fine but the the content is not write into file with write() method. I ask the user input with JoptionPane and add that data to ArrayList . The data is added , but when I try to output that...
RajaParajuli
1

votes
2

answer
69

Views

Java - Garbage arraylist field of objects in static arraylist

please look at this : class MyUtility{ public static MyStock stock; } class MyStock{ public ArrayList myListOfThings; } class SomeThing{ public ArrayList myWhatever; public double [] myArray; } so i can everywhere access MyUtility.stock (thread safe is not the question) I know the GC wont clean 'myL...
Ledahu
1

votes
2

answer
132

Views

iterating through multidimensional ArrayList

I am confused regarding iterating through a multidimensional ArrayList . I saw some topics about it and they seem complicated. in specific the accepted answer here: How to iterate through two dimensional ArrayList using iterator? can it be as in this method? which iterates through the arrayList and...
ahmed dahy
1

votes
0

answer
21

Views

best way to store list of blobs with corresponding points

What’s the best way to store blobs detected in an image together with their corresponding pixels (points)? List of Lists? ArrayList? This is what I‘d like to end up with: Blobs[0] .... Blobs[x] and for each one of them I‘d like to be able to retrieve all points found in the individual blob (...
user10268955
1

votes
1

answer
45

Views

Extract unique values from a range in excel while disregarding specific values

I originally had an Excel spreadsheet which was used to record values of JOB LOT IDs (>10000). I used the following array formula - =INDIRECT(TEXT(MIN(IF(($C$3:$S$52'')*(COUNTIF($V$3:V3,$C$3:$S$52)=0),ROW($3:$52)*100+COLUMN($C$S),7^8)),'R0C00'),)&'' Data: | pallet | Lot# | Lot# | Lot#...
JGPinMA
1

votes
1

answer
74

Views

How do I make a hashmap out of arraylist where one column with repeat values are the keys and corresponding lines as values

I know this a basic question but for some reason I haven't been able to resolve this issue in java although I have been trying and (looking for solutions) for the past few days... I have a tab separated file(large file more than 8000 lines) with multiple columns(few of these columns have spaces and...
Afrah_Rahman
1

votes
0

answer
68

Views

How to create many different objects from one class in Java

I want to create a program in Java that is essentially a book library. I am planning on having a constructor for the class which will take in some parameters. The problem I have is with how I am going to store every single book (I am not very experienced so I may be going about this the wrong way)....
gamerage3
1

votes
0

answer
37

Views

Sort / segregrate objects based on its type and create / put it on arraylist

What i want to attain is to sort the array of object that i currently i have : MixGroup = [PHP,PHP,PHP,EUR,USD,EUR,EUR,USD,PHP] what i want to do is to put them into one array into their respective currencies like this : MixGroup = [PHP[] , EUR[], USD []]. I'm currently new into java programming. wh...
1

votes
1

answer
37

Views

Unable To Load Data File With ArrayList <Java>

I am currently working on a programming assignment for school. I've been working on my code for hours, along with searching online for an answer and had no luck. Basically, I am given eight text files that contain several lines of data like this: Henrietta Andersen 8 10 9 10 10 9 7 9...
auprest
1

votes
1

answer
56

Views

Xpages dojo listTextBox vertical stack?

How do I stack items in a djListTextBox field to line up vertically instead of horizontally? They don't even break cleanly between values when it comes to the boundaries of the cell or panel . I saw a solution HERE, but this solution claims that values displayed in djextListTextBox are surrounded by...
m benway
1

votes
1

answer
99

Views

Is this possible to generate subarray in O(n) time?

I am trying to genarate subarray with the help of following code but the time complexity of this code in O(n^3). Please help me to find out the most optimal way. My code is following: static ArrayList solve(List a) { ArrayList res=new ArrayList(); for(int i=0;i
imsaiful
1

votes
1

answer
45

Views

Not sure why i'm getting an java.util.NoSuchElementException error

I am currently working on a program where I take information from a text document, then I print it out into another file and from java but halfway through, i'm getting an no such exception error and i'm not sure why. Tester code: import java.util.ArrayList; import java.util.Scanner; import java.io.F...
mantaray205
1

votes
0

answer
25

Views

How to display my Firebase Database with this array down bellow?

What to pass in getVerticalData() down bellow I want to display the DB in getVerticalData.get(0); What to pass there to display the Database ? How to display my Firebase Database with this array down bellow? private ArrayList objects = new ArrayList
Miguel Nuno
1

votes
2

answer
33

Views

I have a 3 column Listview with data from SQLite DB and a seachview window. i created a custom data. The search is not properly executed

I have created a MultiColumn ListView with a SearchView above it. It pulls data from an SQLite database and displays in the list view. I have created a custom ArrayAdapter and the java class. However, the output from my SearchView on my 3 column custom array list view is not returning the correct da...
Noruwa

View additional questions