Skip to content

Finished Derusting project#14

Open
JesseChum wants to merge 5 commits intoauberonedu:mainfrom
JesseChum:main
Open

Finished Derusting project#14
JesseChum wants to merge 5 commits intoauberonedu:mainfrom
JesseChum:main

Conversation

@JesseChum
Copy link
Copy Markdown

Some questions I didn't understand if I needed to actually print something unless specifically specified. So I gave what I thought would be a good implementation. It's good practice overall.

Copy link
Copy Markdown
Owner

@auberonedu auberonedu left a comment

Choose a reason for hiding this comment

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

Nice job! See comments below.

Comment thread src/ArrayPractice.java
String valueAtIndex = arr[2];
// Get the length of the array

int[] length = new int[4];
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This creates a new array. How would you go about finding the length of the existing array arr?

Comment thread src/ListPractice.java
Comment on lines +39 to +42
for (String i : list){
System.out.println();
System.out.println(i);
}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Here and throughout your code try to be a bit more consistent in you indentation.

Comment thread src/MapPractice.java
// Create a HashMap with String keys and Integer values and
// assign it to a variable of type Map

HashMap<String, Integer> people = new HashMap<String, Integer>();
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Remember to use interface types (Map)

Comment thread src/MapPractice.java
Comment on lines +32 to +34
for (String i : people.keySet()) {
System.out.println("key: " + i + " value: " + people.get(i));
}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This works! Can you find another method that works directly with the map entries, looping over the keys and values in a single set?

Comment thread src/SetPractice.java
public static void main(String[] args) {
// Create a HashSet of Strings and assign it to a variable of type Set

HashSet<String> helicopters = new HashSet<String>();
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Remember to use interface types (Set)

Comment thread src/StringPractice.java
}
// Create an ArrayList of Strings and assign it to a variable

ArrayList<String> bedroom = new ArrayList<String>();
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Remember to use interface types (List)

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.

2 participants