Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Commit

Permalink
#434 Fix readability nits
Browse files Browse the repository at this point in the history
  • Loading branch information
alicederyn authored Aug 31, 2020
2 parents 43c5581 + 78e4c5b commit cedcf72
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ public void addTo(SourceBuilder code) {
.addLine(" @Override public V put(K key, V value) {")
.addLine(" K oldKey = biMap.inverse().get(value);")
.addLine(" %s.checkArgument(", Preconditions.class)
.addLine(" oldKey == null || %s.equals(oldKey, key),"
+ " \"value already present: %%s\", value);",
Objects.class)
.addLine(" oldKey == null || %s.equals(oldKey, key),", Objects.class)
.addLine(" \"value already present: %%s\", value);")
.addLine(" V oldValue = biMap.get(key);")
.addLine(" forcePut.accept(key, value);")
.addLine(" return oldValue;")
Expand Down Expand Up @@ -131,9 +130,8 @@ public void addTo(SourceBuilder code) {
.addLine(" @Override public V setValue(V value) {")
.addLine(" K oldKey = biMap.inverse().get(value);")
.addLine(" %s.checkArgument(", Preconditions.class)
.addLine(" oldKey == null || %s.equals(oldKey, key),"
+ " \"value already present: %%s\", value);",
Objects.class)
.addLine(" oldKey == null || %s.equals(oldKey, key),", Objects.class)
.addLine(" \"value already present: %%s\", value);")
.addLine(" V oldValue = this.value;")
.addLine(" this.value = %s.requireNonNull(value);", Objects.class)
.addLine(" forcePut.accept(key, value);")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,8 @@ private void addPut(SourceBuilder code) {
unboxedValueType.orElse(valueType));
code.addLine(" %s oldKey = %s.inverse().get(value);", keyType, property.getField())
.addLine(" %s.checkArgument(", Preconditions.class)
.addLine(" oldKey == null || %s.equals(oldKey, key),"
+ " \"value already present: %%s\", value);",
Objects.class)
.addLine(" oldKey == null || %s.equals(oldKey, key),", Objects.class)
.addLine(" \"value already present: %%s\", value);")
.addLine(" %s(key, value);", forcePutMethod(property))
.addLine(" return (%s) this;", datatype.getBuilder())
.addLine("}");
Expand Down

0 comments on commit cedcf72

Please sign in to comment.