File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11/*
2- * Copyright © 2016-2025 The LmdbJava Open Source Project
2+ * Copyright © 2016-2026 The LmdbJava Open Source Project
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -85,6 +85,18 @@ public String toString() {
8585 return FlagSet .asString (this );
8686 }
8787
88+ @ Override
89+ public boolean equals (Object object ) {
90+ if (object == null || getClass () != object .getClass ()) return false ;
91+ AbstractFlagSet <?> that = (AbstractFlagSet <?>) object ;
92+ return mask == that .mask && Objects .equals (flags , that .flags );
93+ }
94+
95+ @ Override
96+ public int hashCode () {
97+ return Objects .hash (flags , mask );
98+ }
99+
88100 static class AbstractEmptyFlagSet <T extends MaskedFlag > implements FlagSet <T > {
89101
90102 @ Override
Original file line number Diff line number Diff line change 11/*
2- * Copyright © 2016-2025 The LmdbJava Open Source Project
2+ * Copyright © 2016-2026 The LmdbJava Open Source Project
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -67,8 +67,14 @@ void testSingleFlagSet() {
6767 final List <T > allFlags = getAllFlags ();
6868 for (T flag : allFlags ) {
6969 final F flagSet = getBuilder ().addFlag (flag ).build ();
70+
71+ // Compare as a Set
72+ assertThat (flagSet .getFlags ()).isEqualTo (flag .getFlags ());
73+ // Compare as a FlagSet
74+ assertThat (flagSet ).isEqualTo (flag );
75+
7076 assertThat (FlagSet .equals (flagSet , flag )).isTrue ();
71- assertThat ( FlagSet . equals ( flagSet , flag . getFlags ())). isTrue ();
77+
7278 assertThat (flagSet .getMask ()).isEqualTo (flag .getMask ());
7379 assertThat (flagSet .getMask ()).isEqualTo (MaskedFlag .mask (flag ));
7480 assertThat (flagSet .getFlags ()).containsExactly (flag );
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright © 2016-2026 The LmdbJava Open Source Project
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
116package org .lmdbjava ;
217
318import static org .junit .jupiter .api .Assertions .*;
You can’t perform that action at this time.
0 commit comments