Skip to content

Commit

Permalink
Latest docs on successful build 6014 auto-pushed to gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
copybara-service[bot] committed Feb 26, 2024
1 parent ec93c8a commit ffb6003
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions bugpattern/EnumOrdinal.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,18 @@ Prefer using enum value directly:
ImmutableMap<MyEnum, String> MAPPING =
ImmutableMap.<MyEnum, String>builder()
.put(MyEnum.FOO, "Foo")
.put(MyEnum.BAR, "Bar");
.put(MyEnum.BAR, "Bar")
.buildOrThrow();
```

to this:

```java
ImmutableMap<Integer, String> MAPPING =
ImmutableMap.<MyEnum, String>builder()
ImmutableMap<Integer, String> MAPPING =
ImmutableMap.<Integer, String>builder()
.put(MyEnum.FOO.ordinal(), "Foo")
.put(MyEnum.BAR.ordinal(), "Bar");
.put(MyEnum.BAR.ordinal(), "Bar")
.buildOrThrow();
```

Or if you need a stable number for serialisation, consider defining an explicit
Expand Down

0 comments on commit ffb6003

Please sign in to comment.