Skip to content

Commit

Permalink
Update JavaExamples.java
Browse files Browse the repository at this point in the history
  • Loading branch information
txiang61 authored Apr 26, 2024
1 parent 10a07e3 commit 15c5406
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions JavaExamples.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ void foo(Set<String> s) {
// Mutating immut set, `new_s` is immut
void foo1(@Mutable Set<String> s) {
Set<String> new_s = new HashSet<>(s);
Set<String> new_s1 = s;
new_s.add("x"); // ERROR
new_s1.add("x"); //OK
}

// Mutating mut set
Expand Down

0 comments on commit 15c5406

Please sign in to comment.