diff options
Diffstat (limited to 'ex1/src/main/java/reflection/api/ReflectionInvestigator.java')
| -rw-r--r-- | ex1/src/main/java/reflection/api/ReflectionInvestigator.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ex1/src/main/java/reflection/api/ReflectionInvestigator.java b/ex1/src/main/java/reflection/api/ReflectionInvestigator.java index 10a4366..3f802d2 100644 --- a/ex1/src/main/java/reflection/api/ReflectionInvestigator.java +++ b/ex1/src/main/java/reflection/api/ReflectionInvestigator.java | |||
| @@ -2,7 +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.ArrayDeque; |
| 6 | import java.util.HashSet; | 6 | import java.util.HashSet; |
| 7 | import java.util.Set; | 7 | import java.util.Set; |
| 8 | import java.util.stream.Collectors; | 8 | import java.util.stream.Collectors; |
| @@ -125,13 +125,13 @@ public class ReflectionInvestigator implements Investigator { | |||
| 125 | 125 | ||
| 126 | @Override | 126 | @Override |
| 127 | public String getInheritanceChain(String delimiter) { | 127 | public String getInheritanceChain(String delimiter) { |
| 128 | var nameStack = new ArrayList<String>(); | 128 | var nameStack = new ArrayDeque<String>(); |
| 129 | var cursor = classInfo; | 129 | var cursor = classInfo; |
| 130 | do { | 130 | do { |
| 131 | nameStack.add(cursor.getSimpleName()); | 131 | nameStack.push(cursor.getSimpleName()); |
| 132 | cursor = cursor.getSuperclass(); | 132 | cursor = cursor.getSuperclass(); |
| 133 | } while (cursor != null); | 133 | } while (cursor != null); |
| 134 | 134 | ||
| 135 | return String.join(" >> ", nameStack.reversed()); | 135 | return String.join(" >> ", nameStack); |
| 136 | } | 136 | } |
| 137 | } | 137 | } |