I have a big doubt and I hope someone can help me out. I need to delete some objects from an arraylist if they meet a condition and I'm wondering which ... |
I'm trying to delete an item from an array list by selecting it from a JList and clicking "Delete"......
The code i have so far is
buttondeleteContact.addActionListener(new ActionListener() {
...
|
Ive made an address book. I can currently write to the arraylist and save it back to the .buab file, but I cant delete from the arraylist and export it ... |
I'm trying to delete an int[] from an ArrayList.
Due to my code I only have the values so I'm creating the array and then call remove();
int[] pos = new int[]{0,1};
positionList.remove(pos);
positionList is ... |
again i'm here with my classes, my software is almost done after finishing last two things i will continue to GUI development. Anyway, here is my code:
public class Team
{
...
|
I'm doing a simple program using arraylist. But I've encountered an error.
After deleting an element in the arraylist, using this code:
delnum=scanz.nextLine();
intdelnum=Integer.parseInt(delnum);
nem.remove(intdelnum);
corz.remove(intdelnum);
skul.remove(intdelnum);
gen.remove(intdelnum);
I'm having problems with adding another record after a delete. ... |
i have an arraylist called Module, i want to create a method that will delete a module from the ArrayList based on the index passed as the parameter. this is ... |
|
I'm using Java for a data mining project and am having an odd issue with an ArrayList.
The ArrayList (availAttribs) contains the names of all the attributes not yet used in the ... |
iterator.remove(). is good however my question: if I want while to iterate, for a kind of condition, to delete another object from the array List.
Example (al being the arraylist)
for ...
|
Assuming I have an ArrayList of ArrayLists created in this manner:
ArrayList< ArrayList<String> > listOfListsOfStrings =
...
|
I have an ArrayList, and I need to filter it (only to remove some elements).
I can't modify the original list.
What is my best option regarding performances :
- Recreate another list from the ...
|
I have a method that takes in a string array and finds the averages of every few items depending on the length. I would like the method to delete the ... |
How do you avoid an ArrayList object in (Java) from being modified, i.e. avoid adding and deleting its content
|
Basically, the user submits a String which the Iterator searches an ArrayList for. When found the Iterator will delete the object containing the String.
Because each of these objects contain two Strings, ... |
|
|
for (int d = 0; d < list.size(); d++) { if (list.get(d).getname().equals(delete)); list.remove(d); } ************************************************************************************************************* so i have an import command delete jet li where my code is surpose to look for the word delete and the next word/s after that (jet li) and the loop should look through the arraylist increment through 1 thing at a time until it finds ... |
|
How about during your search method, you keep track of the index of the object being searched for. Then when that search has been completed, store the index of the object somewhere. Then all your delete method need do is remove the object at that index. You will also need some logic that prevents a user from hitting the delete button ... |
1) Is this Swing? If so, you'll want to call repaint, not update(xxx.getGraphics). You'll also want to ask similar questions in the future in the Swing forum (though lets leave this thread here). 2) Your best bet is to simplify your problem and try to solve it in this simple environment, then when solved implement it in your final program. So ... |
Your problem goes back to the design. The items added to the list are of two different types, one is the name, one is the money. You should either combine these together into an object that contains both the name and the money or you should use a Map (such as HashMap or TreeMap) keyed on the name. |
|