Data dodania Pytanie
2018-02-14 10:02 Remove multiple items from ArrayList during iterator »
Is it safe to remove multiple items from an ArrayList while iterating through it with an iterator? Iterator<String> iterator = nameList.iterato...
(4) odpowiedzi
2018-02-10 15:02 turn string separated by spaces to arraylist of integers in one line »
Say I have the String "5 12 4". I'd like to turn that into an ArrayList of Integers containing 5,12 and 4 in a single functional line. I feel there ...
(2) odpowiedzi
2018-02-10 15:02 Why assigning time in ArrayList and List is the same when adding 10000000 integers? »
I have the following code in which I compare the performance of the ArrayList and List through adding 10000000 integer numbers. In ArrayList I have bo...
(2) odpowiedzi
2018-02-06 04:02 Group array of items by their distinct id »
How do I go about re-arranging my array to by organized by shirt size: [ { shirt_id: 1, size: "small" }, { shirt_id: 1, size: "medium" }, { shi...
(2) odpowiedzi
2018-01-23 17:01 Separate a list of items into new, present and present-and-needs-stuff-done-to-it »
I have a list of items which I want in my database. Some of the items are new and have to be saved, others are already in the database, but have to be...
(3) odpowiedzi
2018-01-14 17:01 What is difference between of listofIntegers.add(ValueOf(50)); and listofIntegers.add(50); in Java »
What is the difference between these 2 codes: Arraylist<Integer> listofIntegers = new Arraylist<Integer>(); listofIntegers.add(666); Syst...
(1) odpowiedzi
2017-12-30 07:12 Check whether list of custom objects have same value for a property in Java 8 »
I am new to Java 8. I have a list of custom objects of type A, where A is like below: class A { int id; String name; } I would like t...
(7) odpowiedzi
2017-12-27 09:12 How to order a List by distance »
I have two lists, one of users the other of distance and I would like to order the user by distance. This is the lists public ArrayList<String&g...
(3) odpowiedzi
2017-12-26 07:12 Add a first value to spinner when spinner data is came from server »
I want to set first spinner value as "select your choice" then shows the data from server one solution * creates another array list and in that list...
(7) odpowiedzi
2017-11-28 10:11 Check for null object and null value contained in object in Java 8 way »
how to rewrite this function to be more Java 8 with Optionals? Or should I just leave it as it is? public void setMemory(ArrayList<Integer> mem...
(9) odpowiedzi
2017-11-18 13:11 ArrayList object is returing one row on ListView in java android »
I am trying to add Objects from MySQL database on ArrayList Object but result gives me only one row i am using custom adapter on my ListView, i think...
(3) odpowiedzi
2017-11-18 10:11 Sorting array of dictionary in alphabetic order »
I have an array of 3 objects. The objects are of type of dictionaries. Each dictionary has different keys. I want sort this array in alphabetic order....
(1) odpowiedzi
2017-11-11 20:11 How do you order the elements in an ArrayList in Java? »
Suppose that you have a class Person with several attributes, and an ArrayList ordered in ascending order of an attribute of Person (age for example)....
(1) odpowiedzi
2017-11-04 14:11 First list is sorted and the other is unsorted now which is the better approach to merge both list »
I have one Sorted ArrayList A and one unsorted ArrayList B, now I want to merge items of B in A such that A remains sorted. Now I can think of only t...
(2) odpowiedzi
2017-10-22 08:10 sort listview by existence in another arraylist »
In an android program I am creating, each user will have an arraylist preference, the code i'm using will just make the question needlessly complex, b...
(3) odpowiedzi
2017-10-19 13:10 Return specific value when list is out of range in Python »
How can I return a specific value if the list is out of range? This is the code I have so far: def word(num): return ['Sunday','Monday','Tuesday','...
(5) odpowiedzi
2017-10-12 16:10 Arranging strings in ascending and descending order using array lists »
I wrote a post before with a much more rudimentary version of the following code. I rearranged it, but it still doesn't work. Whenever I input a new ...
(2) odpowiedzi
2017-10-06 15:10 ArrayList find custom object quickly »
I'm using ArrayList to store CustomObjects, problem is that it takes time to find an object in that list in order to remove it. (around 100K elements)...
(1) odpowiedzi
2017-09-26 08:09 Removing Objects in Java ArrayList - Time Consumption »
I'm trying to remove 140,000 objects from an ArrayList of size 7,140,000. I expected this would take seconds (if that), but instead Java is taking mu...
(2) odpowiedzi
2017-09-02 11:09 How to print a list by adding a new line after every 3rd element in a list in java lambda expression? »
Suppose I have a list as below Collection<?> mainList = new ArrayList<String>(); mainList=//some method call// Currently, I am displayi...
(3) odpowiedzi
2017-08-22 09:08 Traverse an arraylist of objects and get the maximum quantity value from duplicate objects »
So I have this ArrayList of Product objects. What I'm doing is on click of + button, I am making an object of Product and setting all the attributes f...
(3) odpowiedzi
2017-08-07 19:08 for loop performance iteration »
The question is, "We might expect method3 to run faster than method2, why is that?" but I have no idea. It seems like both methods do the same amount ...
(2) odpowiedzi
2017-07-24 21:07 How to improve Java multi-threading performance? Time efficiency of saving/loading data from NoSQL database (like Redis) vs ArrayList? »
I am evaluating an SDK and I need to cross compare ~15000 iris images stored in a gallery folder and generate the similarity scores as a 15000 x 15000...
(1) odpowiedzi
2017-07-14 03:07 how to add objects extracted from a database to an arraylist? »
i wrote a simple program extracting some data from a database, each line from the table of the database is structured in an object that i create using...
(1) odpowiedzi
2017-07-10 16:07 Java - Overwriting values in a HashMap that are in an ArrayList<String> »
I'm fairly new to coding and I'm running into a slight problem here that I can't figure out. Let's say I have a HashMap with String keys and Integer v...
(8) odpowiedzi
2017-06-11 19:06 How could i transfer duplicate items in other ArrayList? »
I have an array list ArrayList<String> list=new ArrayList<String>(); list.add("Apple"); list.add("Ball"); list.add("Ball"); ...
(5) odpowiedzi
2017-06-01 22:06 Is Java ArrayList really this much slower than C++ vector? »
I do not want to start yet another pointless flamewar about whether Java or C++ is the better language in general. I want to know whether a comparison...
(1) odpowiedzi
2017-05-09 05:05 Why is an ArrayList of ArrayLists not multidimensional? »
I recently appeared for an interview in which the interviewer asked me a question regarding arrays and ArrayList. He asked me if an array of arrays ...
(7) odpowiedzi
2017-04-30 01:04 How to find the max element from an array list of objects? »
Collections.max(arraylist) doesn't work, and a regular for loop won't work either. What I have is: ArrayList<Forecast> forecasts = current.get...
(5) odpowiedzi
2017-03-29 22:03 SilverStripe random order for ArrayList() »
I know that we can randomly sort a DataList with the following: $example = Example::get()->sort('RAND()'); But when I try to randomly sort an Ar...
(2) odpowiedzi
2017-03-16 15:03 toString Method ArrayList simple recursion »
I am trying to print the contents of a list recursively and this is what I should be getting [6, 8] but I am getting [8, 8 6, 6] But it's printing...
(3) odpowiedzi
2017-03-04 20:03 Accessing object's elements of Multiple ArrayList in java »
I cannot access Multiple ArrayList element. The code is given below and it cannot access the values 5 or 6. My IDE is not accepting the last statement...
(2) odpowiedzi
2017-03-04 01:03 How to get distinct values and sum the total on JSON using JS »
How do you get the data from distinct values also sum the total values from the same unique row Here is the JSON Data result As you can see they h...
(2) odpowiedzi
2017-02-11 18:02 Find position of an Imageview inside listview »
I have a List view that I fill the rows via mysql database. This is a view of what I have done: This names that you saw are coming from my databas...
(1) odpowiedzi
2017-02-06 15:02 Pass class type as parameter to use in ArrayList? »
I need to write a java method which takes a class (not an object) and then creates an ArrayList with that class as the element of each member in the a...
(3) odpowiedzi