Hugging Face
Models
Datasets
Spaces
Buckets
new
Docs
Enterprise
Pricing
Log In
Sign Up
Spaces:
KaiquanMah
/
TurkuBasicOOPinJava
like
0
Running
App
Files
Files
Community
main
TurkuBasicOOPinJava
/
Week 7: Enum, Generic Type, Streams, write to file, class diagram
81 kB
Ctrl+K
Ctrl+K
1 contributor
History:
31 commits
KaiquanMah
Upload 17 final-examples.zip
23c765e
verified
9 months ago
01A. Enum Classes+++
Safe
4.83 kB
enum Topic1 {VALUE1, ...}; "someStr" == Topic1.VALUE1;
10 months ago
01B. All Cardinal Directions
Safe
1.64 kB
UPPERCASEVALUES - for Java Constants
10 months ago
02. Class Route
Safe
2.6 kB
Create 02. Class Route
10 months ago
03. Routes in the Given Direction
Safe
2.98 kB
route.getDirection() == direction
10 months ago
04A. Generic Type Definition [in Class, Attribute, Param, Return]+++
Safe
6.05 kB
class Box<TYPE>{private TYPE value; ...}
10 months ago
04B. Generic Duplicator
Safe
3.71 kB
public Constructor(T param){...}; public T method1() {...}
10 months ago
05. Generic Queue Class
Safe
3.25 kB
this.queue.add(0, element);
10 months ago
06A. Generics in Interface Classes++
Safe
1.35 kB
interface Pair<T1, T2> { T1 getFirst(); T2 getSecond(); }
10 months ago
06B. Implement the StringSwapper Class
Safe
2.8 kB
class StringSwapper implements Swapper<String> {...}
10 months ago
07A. Generics and Class Hierarchies????
Safe
3.11 kB
class PersonContainer<T extends Person>
10 months ago
07B. Generic Class MinMax????
Safe
3.16 kB
class MinMax<T extends Comparable<T>>
10 months ago
08A. Streams+++
Safe
3.31 kB
stringList.stream().forEach(strElement -> System.out.println(strElement));
10 months ago
08B. Print Players
Safe
3.34 kB
forEach
10 months ago
09A. sum-average-min-max(), OptionalInt+++
Safe
3.31 kB
OptionalInt; chk ArrayList not empty -> then run getAsInt()
10 months ago
09B. Sum, Average, Minimum, Maximum+++
Safe
2.12 kB
sum returns int - no need getAsInt()
10 months ago
10A. Filtering Elements+++
Safe
2.91 kB
map then filter OR filter (directly)
10 months ago
10B. Print North Routes
Safe
3.42 kB
objList.stream().filter(obj -> obj.method() == value1).forEach(obj -> ...);
10 months ago
11A. Useful Stream Operations+++
Safe
2.09 kB
map mapToInt mapToDouble collect
10 months ago
11B. Sentences Ending with a Period
Safe
2.77 kB
str.substring equals; str.charAt ==; str.endsWith
10 months ago
12A. Writing to a File - PrintWriter+++
Safe
1.89 kB
try (PrintWriter file = new PrintWriter("fileName.txt")) {...}
10 months ago
12B. Names to a File
Safe
1.72 kB
catch (FileNotFoundException e) {...}
10 months ago
13A. Expression Statements+++
Safe
1.99 kB
b = a++ [add, keep initial a]; ++a [add, get new 'a']
10 months ago
13B. Expression Statements Values+++
Safe
538 Bytes
Create 13B. Expression Statements Values+++
10 months ago
14A. Creating List, convert to ArrayList+++
Safe
2.32 kB
List, boxed()
10 months ago
14B. List of Seven Brothers
Safe
990 Bytes
ArrayList<String> list1 = new ArrayList<String>(List.of("item1", ...));
10 months ago
15A. UML Modeling Language
Safe
4.79 kB
Create 15A. UML Modeling Language
10 months ago
15B. Write a class based on UML diagram
Safe
1.44 kB
Create 15B. Write a class based on UML diagram
10 months ago
16. Implement a Class Hierarchy
Safe
1.97 kB
class Class1 implements Interface1 {...}
10 months ago
17 final-examples.zip
pickle
Pickle imports
No problematic imports detected
What is a pickle import?
4.65 kB
xet
Upload 17 final-examples.zip
9 months ago