feat(02-nondupl): Добавлено задание
This commit is contained in:
24
labs/02-nondupl/app/src/main/java/ru/mrqiz/nondupl/App.java
Normal file
24
labs/02-nondupl/app/src/main/java/ru/mrqiz/nondupl/App.java
Normal file
@ -0,0 +1,24 @@
|
||||
package ru.mrqiz.nondupl;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class App {
|
||||
public static void main(String[] args) {
|
||||
HashMap<Integer, Integer> map = new HashMap<>();
|
||||
|
||||
for (String arg : args) {
|
||||
if (!arg.matches("-?\\d+")) {
|
||||
System.err.println("Not int found, skipping " + arg);
|
||||
} else {
|
||||
Integer i = Integer.valueOf(arg);
|
||||
map.put(i, map.getOrDefault(i, 0) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
for (Integer number : map.keySet()) {
|
||||
if (map.get(number) == 1) {
|
||||
System.out.println(number);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user