Suppose:
You have following arraylist-output:
4 AAAAAA
5 ZZZZZZ
2 DDDDDD
1 AAAAAA
3 AAAAAA
one row is one object:
Questions:
how to sort rows on numbers ascending?
==> output = 1 AAAAAA
2 DDDDDD
3 AAAAAA
4 AAAAAA
5 ZZZZZZ
how to sort column 2?
==> output = 1 AAAAAA
3 AAAAAA
4 AAAAAA
2 DDDDDD
5 ZZZZZZ
suppose you want to remove the rows where data = AAAAAA
==> output after this is:
2 DDDDDD
5 ZZZZZZ
I don't understand to do this in a simple way!!!!
Is het possible to give some code concerning this???
Thank you very much!!!
Greetings from a relative new user ......![[pipe] [pipe] [pipe]](/data/assets/smilies/pipe.gif)
existing code:
*
* Created on 21-mei-2004
*
*/
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
public class ReadingFile {
public ReadingFile(String tempFile) throws IOException{
File f = new File(tempFile);
ArrayList al = new ArrayList();
BufferedReader br = new BufferedReader(new FileReader(f));
String line = "";
while ((line = br.readLine()) != null) {
al.add(line);
}
Object[] array = al.toArray();
System.out.println("Object:");
for (int count = 0; count < array.length; count++)
System.out.println(array[count]);
}
public static void main(String args[]) throws IOException
{
ReadingFile rfObj = new ReadingFile("objects.txt");
}
}
You have following arraylist-output:
4 AAAAAA
5 ZZZZZZ
2 DDDDDD
1 AAAAAA
3 AAAAAA
one row is one object:
Questions:
how to sort rows on numbers ascending?
==> output = 1 AAAAAA
2 DDDDDD
3 AAAAAA
4 AAAAAA
5 ZZZZZZ
how to sort column 2?
==> output = 1 AAAAAA
3 AAAAAA
4 AAAAAA
2 DDDDDD
5 ZZZZZZ
suppose you want to remove the rows where data = AAAAAA
==> output after this is:
2 DDDDDD
5 ZZZZZZ
I don't understand to do this in a simple way!!!!
Is het possible to give some code concerning this???
Thank you very much!!!
Greetings from a relative new user ......
![[pipe] [pipe] [pipe]](/data/assets/smilies/pipe.gif)
existing code:
*
* Created on 21-mei-2004
*
*/
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
public class ReadingFile {
public ReadingFile(String tempFile) throws IOException{
File f = new File(tempFile);
ArrayList al = new ArrayList();
BufferedReader br = new BufferedReader(new FileReader(f));
String line = "";
while ((line = br.readLine()) != null) {
al.add(line);
}
Object[] array = al.toArray();
System.out.println("Object:");
for (int count = 0; count < array.length; count++)
System.out.println(array[count]);
}
public static void main(String args[]) throws IOException
{
ReadingFile rfObj = new ReadingFile("objects.txt");
}
}