|
26 | 26 | import build.codemodel.foundation.usage.NamedTypeUsage; |
27 | 27 | import build.codemodel.hierarchical.HierarchicalCodeModel; |
28 | 28 |
|
| 29 | +import java.util.HashSet; |
29 | 30 | import java.util.LinkedHashSet; |
30 | 31 | import java.util.Optional; |
| 32 | +import java.util.Set; |
31 | 33 | import java.util.function.Predicate; |
32 | 34 | import java.util.stream.Collectors; |
33 | 35 | import java.util.stream.Stream; |
@@ -129,10 +131,10 @@ default <T> Stream<T> parents(final Class<T> typeDescriptorClass) { |
129 | 131 | * @return the level of the {@link HierarchicalTypeDescriptor} |
130 | 132 | */ |
131 | 133 | default int level() { |
132 | | - return level(new java.util.HashSet<>()); |
| 134 | + return level(new HashSet<>()); |
133 | 135 | } |
134 | 136 |
|
135 | | - private int level(final java.util.Set<TypeName> visited) { |
| 137 | + private int level(final Set<TypeName> visited) { |
136 | 138 | if (!visited.add(typeName())) { |
137 | 139 | throw new IllegalStateException("Cycle detected in type hierarchy at: " + typeName()); |
138 | 140 | } |
@@ -211,11 +213,11 @@ default <T> Stream<T> ancestors(final Class<T> typeDescriptorClass) { |
211 | 213 | * @return the {@link Optional}ly found <i>first</i> <i>ancestor</i>, otherwise {@link Optional#empty()} |
212 | 214 | */ |
213 | 215 | default Optional<HierarchicalTypeDescriptor> getAncestor(final Predicate<? super HierarchicalTypeDescriptor> predicate) { |
214 | | - return getAncestor(predicate, new java.util.HashSet<>()); |
| 216 | + return getAncestor(predicate, new HashSet<>()); |
215 | 217 | } |
216 | 218 |
|
217 | 219 | private Optional<HierarchicalTypeDescriptor> getAncestor(final Predicate<? super HierarchicalTypeDescriptor> predicate, |
218 | | - final java.util.Set<TypeName> visited) { |
| 220 | + final Set<TypeName> visited) { |
219 | 221 | if (!hasParents()) { |
220 | 222 | return Optional.empty(); |
221 | 223 | } |
|
0 commit comments