All Questions
18
questions
0
votes
1
answer
20
views
Creating object from a file and store them into an arraylist. file is like (tools = 2000; fixTools=500 and etc )
BufferedReader bin = new BufferedReader(new FileReader("C:\\Users\\ASUS\\eclipse-workspace\\MissionMars\\src\\phase-2"));
String line;
ArrayList <Items> point = new ArrayList<Items>();
...
-1
votes
2
answers
411
views
Java Bubble Sort String ArrayList Object
Can someone find why this isn't being sorted I can't seem to find what I have wrong? The output that is being displayed is how I input them after each other thus the sort method isn't working...
// ...
0
votes
2
answers
68
views
Why do I get, and how do I solve this "String to object of type <objecttype>" error
I am (being an absolute beginner), trying to create a simple tool, that creates some objects and links them.
The objects are:
Customers
Licenses (2 types, extends class)
The idea is to use (one of) ...
1
vote
4
answers
57
views
How to remove a range of string objects from an arraylist based on first initials inputted by the user?
So I have a project where I need to create an arraylist of all fifty states. Then I must allow the user to enter two different letters of the alphabet. Then I have to remove all of the states ...
0
votes
5
answers
419
views
How do I take an array of strings and separate them further into objects?
I have an array of strings identifying a pet name, type of animal, age and their owner's name (each attribute is separated by a comma):
String[] petInfo = ["Spot, dog, 2, Joey", "Kip, dog, 3, Jack", "...
0
votes
1
answer
42
views
Transferring one object's ArrayList's contents to another [duplicate]
I'm trying to transfer the contents of an ArrayList from one Book object to the other Book object. The method would be called as
bookA.transfer(bookB);
However, with the code below, I get an error ...
0
votes
3
answers
92
views
How do I compare strings held in an object which are held in an ArrayList and then add the value of those strings(if they are equal to one another)
How do I compare strings held in an object which are held in an ArrayList and then add the value of those strings(if they are equal to one another)?
I understand how to check if StringX == StringY or ...
1
vote
3
answers
154
views
String from object does not equal string from the same object in an ArrayList
I'm building a catalogue using an ArrayList to hold an object called boot.
I haverun into a problem with one of the methods in my catalogue class. The method is supposed to run through the catalogue ...
0
votes
3
answers
6k
views
How to find the longest string object in an arrayList
Here is is my problem, I have to explain a lot, because it's a quite complicated.
I have created an arrayList<Word>, that contains strings as objects. In my case, I have three classes, all working ...
1
vote
1
answer
43
views
Saving object into a list and modifying a string for the object without modifying entry in the list?
I'm trying to pass an object into a list. The object has a String attribute called "moves". After I've passed the object into the ArrayList I'd like to modify the object to reset the value of "moves" ...
0
votes
2
answers
69
views
ClassCastException when I do ObjectList = StringList
I created list using method Arrays.asList() with one String.
Then I assigned it to List<Object>, and I get ClassCastException.
What did I do wrong?
The code is:
class A {
Object value;
...
0
votes
3
answers
193
views
How to Check the Value Associated to String Object in ArrayList?
I have an ArrayList with multiple objects of different types.
At one index I have an element with a String value. I know the index location and I know the string is associated with either a integer ...
-4
votes
4
answers
258
views
A Java ArrayList Qusetion
Question: If you have a List and it has String objects, which declaration(s) of your List does not require that objects retrieved using the get method be cast to Strings, before calling a String ...
0
votes
3
answers
1k
views
ArrayList<Object> to ArrayList<String>
I have made an ExpandableListView with ArrayList as groupItem and ArrayList as childItem:
public void setGroupData() {
groupItem.add("TechNology");
groupItem.add("Mobile");
groupItem.add("...
-5
votes
2
answers
258
views
Connecting 3 different java files
First it starts off with the class College tester, it askes the user for a command.
The first command will be to add. what adding does is it askes the user to enter a name ( with at least 2 words by ...