File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -25,8 +25,6 @@ We have a mix of Optional and allowing null values because GraphQL Java was orig
2525
2626We are aiming to not use Optional moving forward in order to be consistent overall.
2727
28-
29-
3028### Unit testing and dependencies
3129All tests are written in [ Spock] ( http://spockframework.org ) .
3230
@@ -80,7 +78,7 @@ Every public data class should be:
8078
8179- Immutable
8280- having a Builder class
83- - having a transform method
81+ - having a ` transform ` method
8482
8583
8684Every data class should be immutable and contain a ` public static class Builder {..} ` with a static factory method ` newFoo ` (not ` newBuilder ` ).
@@ -91,3 +89,16 @@ The class should also contain a `public Foo transform(Consumer<Builder> builderC
9189
9290Private classes should follow the same design, but they don't have to.
9391
92+ ### Default Collections idiom
93+
94+ The default pattern for using Set, Map and List is:
95+ - List<Foo > fooList = new ArrayList<>();
96+ - Set<Foo > fooSet = new LinkedHashSet<>();
97+ - Map<Foo > fooMap = new LinkedHashMap<>();
98+
99+ By using the generic interface instead of using an implementation we are making sure we
100+ don't rely on anything impl specific.
101+ The default implementations for ` Set ` and ` Map ` should be the ` LinkedHashSet ` and ` LinkedHashMap `
102+ because it offers stable iteration order.
103+
104+
You can’t perform that action at this time.
0 commit comments