Hugging Face
Models
Datasets
Spaces
Community
Docs
Enterprise
Pricing
Log In
Sign Up
Spaces:
KaiquanMah
/
TurkuBasicOOPinJava
like
0
Running
App
Files
Files
Community
16b1b2e
TurkuBasicOOPinJava
/
Week 3: Objects, files and exceptions
41 kB
1 contributor
History:
19 commits
KaiquanMah
for (String city : cityNTemps.keySet())
16b1b2e
verified
6 months ago
10. Array from list
Safe
2.2 kB
Create 10. Array from list
6 months ago
11a Hashmap
Safe
3.07 kB
HashMap<String, Integer>; put get containsKey keySet(= k-v pair)
6 months ago
11b. Combine names and grades
Safe
2.21 kB
HashMap<String, Integer> map = new HashMap<>();
6 months ago
12. Coldest city
Safe
2.68 kB
for (String city : cityNTemps.keySet())
6 months ago
1a Objects and references
Safe
3.46 kB
obj1.equals(obj2)
6 months ago
1b. Calculator
Safe
2.14 kB
Create 1b. Calculator
6 months ago
2. Names to list - equals
Safe
2.05 kB
equals
6 months ago
3a. Objects as parameters and return values
Safe
679 Bytes
someMethod(ArrayList<Integer> list)
6 months ago
3b. Add sum to list - RECREATE LIST
Safe
2.15 kB
ArrayList<Integer> lista = new ArrayList<>(); for (int l : pa) lista.add(l);
6 months ago
4. Remove negative numbers - get, remove
Safe
2.49 kB
get, remove
6 months ago
5a. Method side effects
Safe
1.11 kB
eg change order
6 months ago
5b. Second smallest without side effects
Safe
2.2 kB
Collections.min/max, THEN go through list to find secondSmallest
6 months ago
6B. Create a list
Safe
2.04 kB
Create 6B. Create a list
6 months ago
6a. Objects as return values
Safe
1.8 kB
ArrayList<String> list = new ArrayList<>();
6 months ago
7. Convert to a number list
Safe
3.06 kB
"" + someInt; Integer.parseInt(str)
6 months ago
8. Combine lists
Safe
2.99 kB
newList.addAll(list1); Collections.sort(newList)
6 months ago
9a. Data structure - ARRAY
Safe
3.36 kB
String[] names = new String[16]; arr.length; list.size(); str.length();
6 months ago
9b. Sum of array elements
Safe
1.28 kB
Create 9b. Sum of array elements
6 months ago