arraylist

Adding object to ArrayList

拟墨画扇 提交于 2019-12-25 17:51:23
问题 I'm trying to add objects received from Firebase Database to an ArrayList. However, the list stays empty even after calling the add method. What am I doing wrong? I'm trying to load data from firebase and is display it in a list view. I used log statements to check if the data from firebase is being received and it is. Anybody with suggestions? public class RescueFragment extends Fragment { public RescueFragment() { // Required empty public constructor } @Override public View onCreateView

Sorting an Arraylist that contains strings with numbers [closed]

本秂侑毒 提交于 2019-12-25 17:46:58
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 5 years ago . I have an ArrayList made up of strings. This ArrayList contains... "60 Minutes" "120 Minutes" "30 Minutes" If I use Collections.sort(ArrayList); it results in "120 Minutes" first. This is because the "1" in "120 is obviously smaller than the "3" in "30" Is there a simple way I can sort this

Java - Sorting ArrayList by string attribute from file [closed]

[亡魂溺海] 提交于 2019-12-25 17:44:44
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . Here is what I have been trying to achieve the whole day. I currently have a class which has the attributes for my objects with setters and getters. I have another class where I read my CSV file and put it in a ArrayList. Every row of the file is a object and every column is a attribute which I have assigned and

Traversing a 2D array in four directions (up, down, left, right) [closed]

雨燕双飞 提交于 2019-12-25 16:52:59
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago . I'm trying to create a method for traversing a square 2-dimensional array which takes in a parameter that specifies the direction, either up, down, left or right. I've been able to split the task into two separate methods; one for traversing vertically and one for traversing

automation error -2146232576 (80131700) on creating an array

只愿长相守 提交于 2019-12-25 16:47:47
问题 I have a macro that's working on one computer just fine, however when I try to run it on another computer I get the following error: Run-time error '-2146232576 (80131700)' Automation error Here's the code: Sub Kaivuri() Dim i As Long Dim arvoKohta As Integer Dim etuKohta As Integer Dim sukuKohta As Integer Dim yritysKohta As Integer Dim tulosMaara As Integer Dim ws As Worksheet Dim hakuSana As String Dim arvo As String Dim etunimiLista As Object Dim sukunimiLista As Object Dim riviLista As

Logical conjunction for multiple arraylists

ε祈祈猫儿з 提交于 2019-12-25 12:49:19
问题 There are multiple arraylists (the number of arraylists is apriori unknown). In each arraylist I need to find an element that provides logical conjunction with elements from other lists. Note that the comparison is made only for non-null values. ArrayList<Integer[]> list1 = new ArrayList<Integer[]>(); ArrayList<Integer[]> list2 = new ArrayList<Integer[]>(); ArrayList<Integer[]> list3 = new ArrayList<Integer[]>(); list1.add(new Integer[]{1,2,3,4}); list1.add(new Integer[]{1,4,5,6}); list2.add

Stopping an iteration of an ArrayList in Java

你。 提交于 2019-12-25 12:48:08
问题 I'm iterating an ArrayList of clients named clientList that contains clients from the class Client (user,pass) ArrayList<Client> clientList= new ArrayList<Client>(); Here's the iteration. I want to stop the iteration if it founds a given user (user) and if the password (pass) matches: for (Client c : clientList) { userA = c.getUser(); if (userA.equals(user)) { passA = c.getPassword(); if (passA.equals(pass)) { loginOK = true; found= true; } I was trying the following while (found == false)

How to pass the objects of two arraylists to one another at a specified index

六眼飞鱼酱① 提交于 2019-12-25 12:48:06
问题 So, I am trying to print out my arraylists in order of the objects area. I cannot however seem to figure out how to pass the values of objects to one another at an index. (I must do it recursively). Here is my code thusfar private static void recursionSort(ArrayList<GeometricObject> data) { if(data.size() <= 1) return; // Base case: just 1 elt ArrayList<GeometricObject> a = new ArrayList<GeometricObject>(data.size() / 2); ArrayList<GeometricObject> b = new ArrayList<GeometricObject>(data.size

Adding String object to ArrayList

无人久伴 提交于 2019-12-25 11:59:15
问题 I am trying to create a method in my code that searches through an array list (in my case customerList, which contains Customer objects) and will add something new to it if that something isn't found in the ArrayList... Here is how I have it all set up.... public class CustomerDatabase { private ArrayList <Customer> customerList = null; public CustomerDatabase() { customerList = new ArrayList<Customer>(); } and this is the method I'm trying to make. I'm trying to get it so that it will add a

Adding String object to ArrayList

帅比萌擦擦* 提交于 2019-12-25 11:59:08
问题 I am trying to create a method in my code that searches through an array list (in my case customerList, which contains Customer objects) and will add something new to it if that something isn't found in the ArrayList... Here is how I have it all set up.... public class CustomerDatabase { private ArrayList <Customer> customerList = null; public CustomerDatabase() { customerList = new ArrayList<Customer>(); } and this is the method I'm trying to make. I'm trying to get it so that it will add a