Skip to content

Commit c6005eb

Browse files
authored
Merge pull request #2393
newMain
2 parents 92a5503 + c55edd8 commit c6005eb

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

1.JavaSyntax/src/com/javarush/task/pro/task12/task1227/Solution.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,25 @@ public class Solution {
1818

1919
public static void main(String[] args) {
2020
rescueRobots();
21+
printList(cableContents);
2122
emptyGarbageBin();
2223
printList(rescuedRobots);
2324
}
2425

2526
public static void rescueRobots() {
2627
for (int i = 0; i < cableContents.size(); i++) {
2728
Robot robot = cableContents.get(i);
28-
if (robot.getName().equals("Amigo")) {
29-
rescuedRobots.add(robot);
30-
cableContents.remove(robot);
31-
i--;
32-
} else if (robot.getName().equals("Diego")) {
29+
if (robot.getName().equals("Amigo") || robot.getName().equals("Diego")) {
3330
rescuedRobots.add(robot);
3431
cableContents.remove(robot);
3532
i--;
3633
}
3734
}
35+
// List<Robot> list = cableContents.stream()
36+
// .filter(robot -> robot.getName().equals("Amigo") || robot.getName().equals("Diego"))
37+
// .toList();
38+
// cableContents.removeAll(list);
39+
// rescuedRobots.addAll(list);
3840
}
3941

4042
private static void emptyGarbageBin() {
@@ -43,8 +45,8 @@ private static void emptyGarbageBin() {
4345
}
4446

4547
public static void printList(List<Robot> list) {
46-
for (Robot o : list) {
47-
System.out.print(o + " ");
48+
for (Robot robot : list) {
49+
System.out.print(robot + " ");
4850
}
4951
System.out.println();
5052
}

1.JavaSyntax/src/com/javarush/task/pro/task17/task1701/Solution.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ public static void main(String[] args) {
55
Bat bat = new Bat();
66
bat.move();
77
}
8-
}
8+
}

4.JavaCollections/src/com/javarush/task/task32/task3204/Solution.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ public static ByteArrayOutputStream getPassword() {
2121

2222
char[] password = new char[8];
2323
String string = "";
24-
while (!string.matches(".*\\d.*") || !string.matches(".*[a-z].*") || !string.matches(".*[A-Z].*")) {
24+
while (!string.matches(".*\\d.*") ||
25+
!string.matches(".*\\p{Ll}.*") ||
26+
!string.matches(".*\\p{Lu}.*")) {
2527
for (int i = 0; i < password.length; i++) {
2628
password[i] = template.charAt(new Random().nextInt(template.length()));
2729
}

4.JavaCollections/src/com/javarush/task/task37/task3707/AmigoSet.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77

88
public class AmigoSet<E> extends AbstractSet<E> implements Serializable, Cloneable, Set<E> {
99

10-
private static final Object PRESENT = new Object();
11-
1210
private transient HashMap<E, Object> map;
11+
private static final Object PRESENT = new Object();
1312

1413
public AmigoSet() {
1514
this.map = new HashMap<>();
@@ -35,7 +34,6 @@ public int size() {
3534
return map.size();
3635
}
3736

38-
3937
@Override
4038
public boolean isEmpty() {
4139
return map.isEmpty();

0 commit comments

Comments
 (0)