Commit 1274e0e1 by Patryk Czarnik

plik mcdonadls.csv oraz poprawki w programach

parent 4948a58f
This diff is collapsed. Click to expand it.
......@@ -21,7 +21,7 @@ public class IteratoryListowe {
while(it.hasNext()) {
String element = it.next();
System.out.println(element);
System.out.println(it.previousIndex() + ": " + element);
if("ela".equals(element)) {
it.add("maja"); // za element bieżący, ale nowowstawione elementy nie będą odwiedzone przez ten iterator
it.add("gucio");
......
......@@ -49,7 +49,7 @@ public class Sortowanie2 {
System.out.println(lista);
lista.sort(Collator.getInstance(Locale.CANADA_FRENCH));
System.out.println(lista);
lista.sort(Collator.getInstance(new Locale("pl", "PL")));
lista.sort(Collator.getInstance(Locale.of("pl", "PL")));
System.out.println(lista);
}
}
......@@ -16,7 +16,7 @@ public class P1_Tablica {
String[] tablica = new String[size];
for(int i = 0; i < tablica.length; i++) {
System.out.print("Podaj imię nr " + i + ": ");
System.out.print("Podaj imię nr " + i + ": ");
String imie = scanner.nextLine();
tablica[i] = imie;
}
......
......@@ -13,6 +13,10 @@ public class P3_HashSet {
// → TreeSet samoczynnie sortuje elementy
// Podstawową (i wydajną) operacją dla zbioru jest sprawdzenie czy element należy do zbioru.
// Operacje, na które zbiór patrzy, aby stwierdzić, czy obiekty są sobie równe, to:
// - hashCode i equals w przypadku HashSet, LinkedHashSet
// - compare lub compareTo w przypadku TreeSet
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
......
......@@ -15,7 +15,7 @@ public class P5_HashMap {
Scanner scanner = new Scanner(System.in);
// W tym słowniku dla imienia osoby pamiętamy wiek tej osoby.
// String (mię) jest kluczem, Integer (wiek) jest wartością.
// String (imię) jest kluczem, Integer (wiek) jest wartością.
Map<String, Integer> slownik = new HashMap<>();
while(true) {
......
......@@ -29,7 +29,7 @@ public class ConcMap {
private static final int R = 10_000;
// odkomentuj jedną z wersji i sprawdź
//private final Map<String, Integer> map = Collections.synchronizedMap(new HashMap<>());
// private final Map<String, Integer> map = Collections.synchronizedMap(new HashMap<>());
private final Map<String, Integer> map = new ConcurrentHashMap<>();
//private final ConcurrentMap<String, Integer> map = new ConcurrentHashMap<>();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment