diff options
| author | Kostya <mail@sartin.in> | 2026-07-22 21:56:34 +0000 |
|---|---|---|
| committer | Kostya <mail@sartin.in> | 2026-07-22 21:56:34 +0000 |
| commit | 5a2a1d1e30341b917d54a4509a2d89c38c2359f8 (patch) | |
| tree | 5615e4a756f7363f9f38b2d48a289919978d78dd /ex1/src/main/java | |
| parent | 2f4cc7c66c41defc04641f0ad0a056e5baf9f618 (diff) | |
| download | java-course-5a2a1d1e30341b917d54a4509a2d89c38c2359f8.tar.gz java-course-5a2a1d1e30341b917d54a4509a2d89c38c2359f8.tar.xz java-course-5a2a1d1e30341b917d54a4509a2d89c38c2359f8.zip | |
unorder hashset lolol
Diffstat (limited to 'ex1/src/main/java')
| -rw-r--r-- | ex1/src/main/java/reflection/api/ReflectionInvestigator.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ex1/src/main/java/reflection/api/ReflectionInvestigator.java b/ex1/src/main/java/reflection/api/ReflectionInvestigator.java index 16fafc1..10a4366 100644 --- a/ex1/src/main/java/reflection/api/ReflectionInvestigator.java +++ b/ex1/src/main/java/reflection/api/ReflectionInvestigator.java | |||
| @@ -2,6 +2,7 @@ package reflection.api; | |||
| 2 | 2 | ||
| 3 | import java.lang.reflect.InvocationTargetException; | 3 | import java.lang.reflect.InvocationTargetException; |
| 4 | import java.lang.reflect.Modifier; | 4 | import java.lang.reflect.Modifier; |
| 5 | import java.util.ArrayList; | ||
| 5 | import java.util.HashSet; | 6 | import java.util.HashSet; |
| 6 | import java.util.Set; | 7 | import java.util.Set; |
| 7 | import java.util.stream.Collectors; | 8 | import java.util.stream.Collectors; |
| @@ -124,13 +125,13 @@ public class ReflectionInvestigator implements Investigator { | |||
| 124 | 125 | ||
| 125 | @Override | 126 | @Override |
| 126 | public String getInheritanceChain(String delimiter) { | 127 | public String getInheritanceChain(String delimiter) { |
| 127 | var nameStack = new HashSet<String>(); | 128 | var nameStack = new ArrayList<String>(); |
| 128 | var cursor = classInfo; | 129 | var cursor = classInfo; |
| 129 | do { | 130 | do { |
| 130 | nameStack.add(cursor.getSimpleName()); | 131 | nameStack.add(cursor.getSimpleName()); |
| 131 | cursor = cursor.getSuperclass(); | 132 | cursor = cursor.getSuperclass(); |
| 132 | } while (cursor != null); | 133 | } while (cursor != null); |
| 133 | 134 | ||
| 134 | return String.join(" >> ", nameStack); | 135 | return String.join(" >> ", nameStack.reversed()); |
| 135 | } | 136 | } |
| 136 | } | 137 | } |