Try to write a method to create a list of tables

I'm using Netbeans/GUI to make a fantasy basketball game program. I'm trying to create methods that create arraylists, that way I can call the method for the array every time I need it for one of my button events, rather than recode the array under e

Incompatible types error in ArrayList but both are String

I'm fairly new to Java so don't attack me lol but I've created two classes and an ArrayList in one of them. I can't compile and get this error: "incompatible types: java.lang.String cannot be converted to int" but nothing is being converted here

Number of Java words

So my code is supposed to return the amount of words (words being lengths of letters) and it works except for when i enter anything 0 or less can some pplease help spot the error?? Edited Code: public class WordCount { public static int countWords(St

Store the return value of the method in ArrayList

I am writing a program that creates a game board, and uses a superclass and subclasses to generate the board. Essentially, I want to use an arrayList that stores the values returned back from the methods of the subclasses of Cell. But I cannot figure

How comparable and comparator work in collections?

This code is from the famous Java SCJP6 book. I can't understand the difference between title and d.getTitle() in the compareTo method. How are both title and d.getTitle() getting and comparing values? class DVDInfo implements Comparable<DVDInfo> {

Effectiveness of the Arraylist.remove method (index)?

I am using the arrayList.remove(index) function. I want to remove 40320 elements from array and it will be done 9 times in my program execution . It's taking so much time. This causes my program execution to be slow. Is there any efficient method to

Only the first item appears in Fill list from asynchronous task

Hello i am trying to build a listview and populate it from values in Mysql database. The list with SimpleAdapter works but i decided to change the listview and use my own adapter that extends ArrayAdapter and create my own listItem and not the HashMa

Multiplication of elements on three ArrayLists in Java

I'm creating two ArrayLists from pre-defined arrays. I need to take each element of the two ArrayLists and multiple the values, with the answers being stored in a third ArrayList. For example: ListA[0] * ListB[0] = ListC[0] I need to output all three

How to match an EXACT string in ArrayList & lt; String & gt;

I want to match an exact string in an ArrayList<String>. Currently this code will execute if myArrayList.contains(wordImLookingFor). if (myArrayList.contains(exactWordImLookingFor)) { Toast.makeText(getApplicationContext(), "Match", Toast.

How to store data in an ArrayList in Java

I am building an android app and I am having trouble with an ArrayList. I am using it to store strings and then putting those strings into a list. I can add new items to the ArrayList no bother but if I go to a new activity and go back to this list t

loop to get the object closest to the input value

I have this Martian class: public abstract class Martian implements Cloneable { int id; public Martian(int id) { this.id = id; } public Object clone() throws CloneNotSupportedException { return super.clone(); } public int getId() { return id; } publi

add items from the list to the string array

I have a String array like, String[] abc= new String[]{}; and my List has some values. I iterate the list and add each list element to string array. for(int i=0; i<errList.size(); i++) { abc[i] = errList.get(i).getSrceCd(); } errList.size() has 6 val

How to display ArrayList data every hour?

I want to show data in this format, 12-22-2011 11:00:00 [12-22-2011 11:13:39] Warning: Contact 'nagiosadmin' service notification command '/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: PROBLEM\n\nService: C:\ Drive Space\nH

Simultaneous Edit Exception: Adding to an ArrayList

The problem occurs at Element element = it.next(); And this code which contains that line, is inside of an OnTouchEvent for (Iterator<Element> it = mElements.iterator(); it.hasNext();){ Element element = it.next(); if(touchX > element.mX &&am

Java game: ArrayList and Iterator vs. thread

Sup guys. I'm writing a simple zombie game for my Java classes and I'm struck with a little problem: the Zombies are a class I made and I'm treating them on an ArrayList, like this: horda.add(new Zumbi( (int)(Math.random()* 750), 0)); Where the argum

Get csv and compare the lines. ArrayList? Java

i dont't use java very often and now i got some Problem. I want to read a CSV file like this one: A,B,C,D A,B,F,K E,F,S,A A,B,C,S A,C,C,S Java don't know dynamic arrays, so i choose an ArrayList. This works so far. The Problem is: How can I store the

How can I get the greatest value from asp.net arraylist

I am using VS2008, and ASP.NET 3.5 C# I have an array list that is populated using a textBox & button for input of numbers. After clicking the button, I need to display the highest number in the arraylist. So far I know I need a loop to compare the t

Edit content in foreach

I tend to use ArrayLists of structures. It is then very easy to cycle through the list with a foreach. The problem I have is I cant use a foreach to modify the structures contents and have to use a for and messy typecasts. ((dataStructure)files[x]).n