Hi, ich möchte ein Programm schreiben das die Doppelten PLZ in meiner liste Zählt. Die CSV Datei hab ich schon eingelesen und ich kann auch alle PLZ ausgeben. Ich weiß aber nicht wie ich jetzt die PLZ zählen kann in der Liste kommt 6 mal 01067 vor und 01065 kommt 5 mal vor usw. Wäre echt nett wenn ihr mir dabei helfen könntet was ich machen muss ich hab keinen Ansatz punkt
[CODE lang="java" title="Java"]import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Scanner;
public class PlzB {
public static void main(String[] args) throws IOException {
Path composersFile = Paths.get("D:\\PLZ.csv");
Scanner fileScanner = new Scanner(composersFile, "UTF-8");
while (fileScanner.hasNextLine()) {
String line = fileScanner.nextLine();
String [] values = line.split(";");
//System.out.println(values[0]); Werden alle PLZ ausgegeben
// System.out.println(vlaues[1]); Werden alle Orte dazu ausgegebn
int plz = Integer.parseInt(values[0]);
String ort = values[1];
}
fileScanner.close();
}
}[/CODE]
[CODE lang="java" title="Java"]import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Scanner;
public class PlzB {
public static void main(String[] args) throws IOException {
Path composersFile = Paths.get("D:\\PLZ.csv");
Scanner fileScanner = new Scanner(composersFile, "UTF-8");
while (fileScanner.hasNextLine()) {
String line = fileScanner.nextLine();
String [] values = line.split(";");
//System.out.println(values[0]); Werden alle PLZ ausgegeben
// System.out.println(vlaues[1]); Werden alle Orte dazu ausgegebn
int plz = Integer.parseInt(values[0]);
String ort = values[1];
}
fileScanner.close();
}
}[/CODE]