Skip to content

Generics#7

Open
spiderh0ok wants to merge 6 commits into
classesfrom
Generics
Open

Generics#7
spiderh0ok wants to merge 6 commits into
classesfrom
Generics

Conversation

@spiderh0ok

Copy link
Copy Markdown
Owner

No description provided.

@Sh-Pe Sh-Pe left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, mostly formatting stuff

Comment thread Information.java Outdated
Comment on lines +3 to +6
T GetLatestValue();
void Update();
T[] AsArray();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice interface but you've required to implement it. InformationSignalInt is an empty file

Comment thread ArrayList.java
Comment on lines +2 to +3
public class ArrayList<T> {
public Object[] arrayList;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public class ArrayList<T> {
public Object[] arrayList;
public class ArrayList<T> {
public Object[] arrayList;

[formatting] run a formatter.

Comment thread ArrayList.java
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++;

}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 thread ArrayList.java
Comment on lines +25 to +28




Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

[formatting] too many enters. one is enough

Comment thread ArrayList.java
Comment on lines +29 to +31
public T get (int location){
return (T)arrayList[location];
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public T get (int location){
return (T)arrayList[location];
}
public T get (int location) {
return (T) arrayList[location];
}

[formatting]

Comment thread ArrayList.java
return (T)arrayList[location];
}

public void set (int location,Object added){

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public void set (int location,Object added){
public void set(int location,Object added){

[formatting]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants