Skip to content

Commit

Permalink
(chores) camel-core: code cleanup
Browse files Browse the repository at this point in the history
Use simpler collections operations
  • Loading branch information
orpiske committed Apr 24, 2024
1 parent bdf77b0 commit 8d5f8ea
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ public void addLenient(String name) {
if (lenient == null) {
lenient = new LinkedHashSet<>();
}
if (!lenient.contains(name)) {
lenient.add(name);
}
lenient.add(name);
}

public void addNotConsumerOnly(String name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,7 @@ public void addDeprecated(String name) {
if (deprecated == null) {
deprecated = new LinkedHashSet<>();
}
if (!deprecated.contains(name)) {
deprecated.add(name);
}
deprecated.add(name);
}

private String computeErrors(String value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,11 @@ public void testRomeks() {
assertTrue(map.containsKey("foo"));
assertTrue(map.containsKey("FOO"));

assertTrue(map.keySet().contains("FOO"));
assertTrue(map.keySet().contains("FoO"));
assertTrue(map.keySet().contains("Foo"));
assertTrue(map.keySet().contains("foo"));
assertTrue(map.keySet().contains("fOO"));
assertTrue(map.containsKey("FOO"));
assertTrue(map.containsKey("FoO"));
assertTrue(map.containsKey("Foo"));
assertTrue(map.containsKey("foo"));
assertTrue(map.containsKey("fOO"));

map.put("FOO", "cake");
assertEquals(1, map.size());
Expand All @@ -335,7 +335,7 @@ public void testRomeksUsingRegularHashMap() {
assertTrue(map.containsKey("foo"));
assertFalse(map.containsKey("FOO"));

assertFalse(map.keySet().contains("FOO"));
assertFalse(map.containsKey("FOO"));

map.put("FOO", "cake");
assertEquals(2, map.size());
Expand Down

0 comments on commit 8d5f8ea

Please sign in to comment.