Generics#7
Open
spiderh0ok wants to merge 6 commits into
Open
Conversation
Sh-Pe
suggested changes
Aug 13, 2025
Comment on lines
+3
to
+6
| T GetLatestValue(); | ||
| void Update(); | ||
| T[] AsArray(); | ||
|
|
There was a problem hiding this comment.
nice interface but you've required to implement it. InformationSignalInt is an empty file
Comment on lines
+2
to
+3
| public class ArrayList<T> { | ||
| public Object[] arrayList; |
There was a problem hiding this comment.
Suggested change
| public class ArrayList<T> { | |
| public Object[] arrayList; | |
| public class ArrayList<T> { | |
| public Object[] arrayList; |
[formatting] run a formatter.
Comment on lines
+11
to
+24
| public void add (T added){ | ||
|
|
||
| if (size == arrayList.length){ | ||
| Object[] newArray = new Object[arrayList.length*2]; | ||
| for (int i = 0; i < arrayList.length; i++) { | ||
| newArray[i] = arrayList[i]; | ||
| } | ||
| newArray[arrayList.length] = added; | ||
| arrayList = newArray; | ||
| } | ||
| arrayList[size] = added; | ||
| size++; | ||
|
|
||
| } |
There was a problem hiding this comment.
Suggested change
| public void add (T added){ | |
| if (size == arrayList.length){ | |
| Object[] newArray = new Object[arrayList.length*2]; | |
| for (int i = 0; i < arrayList.length; i++) { | |
| newArray[i] = arrayList[i]; | |
| } | |
| newArray[arrayList.length] = added; | |
| arrayList = newArray; | |
| } | |
| arrayList[size] = added; | |
| size++; | |
| } | |
| public void add (T added){ | |
| if (size == arrayList.length){ | |
| Object[] newArray = new Object[arrayList.length*2]; | |
| for (int i = 0; i < arrayList.length; i++) { | |
| newArray[i] = arrayList[i]; | |
| } | |
| newArray[arrayList.length] = added; | |
| arrayList = newArray; | |
| } | |
| arrayList[size] = added; | |
| size++; | |
| } |
[formatting] no need for enters at the beginning/end of a func
Comment on lines
+25
to
+28
|
|
||
|
|
||
|
|
||
|
|
There was a problem hiding this comment.
Suggested change
[formatting] too many enters. one is enough
Comment on lines
+29
to
+31
| public T get (int location){ | ||
| return (T)arrayList[location]; | ||
| } |
There was a problem hiding this comment.
Suggested change
| public T get (int location){ | |
| return (T)arrayList[location]; | |
| } | |
| public T get (int location) { | |
| return (T) arrayList[location]; | |
| } |
[formatting]
| return (T)arrayList[location]; | ||
| } | ||
|
|
||
| public void set (int location,Object added){ |
There was a problem hiding this comment.
Suggested change
| public void set (int location,Object added){ | |
| public void set(int location,Object added){ |
[formatting]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.