Skip to content

Commit ab37e22

Browse files
committed
Initial commit
0 parents  commit ab37e22

File tree

618 files changed

+24477
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

618 files changed

+24477
-0
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
target
2+
3+
.idea
4+
.mvn
5+
*.iml
6+
7+
.settings
8+
.classpath
9+
.project

README.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# JAVA-BSC - Java SE haladó
2+
3+
## Javasolt haladás
4+
5+
* Először nézd meg a videót! A videóban szereplő forráskódot a [demos](demos) könyvtárban találod.
6+
* Dolgozd fel a videóhoz tartozó írott anyagot, amelynek itt találod a tartalomjegyzékét, és a következő részekből áll:
7+
* Olvasd el a megfelelő elméleti részt, értelmezd!
8+
* Próbálj válaszolni az ellenőrző kérdésekre!
9+
* Old meg a gyakorlati feladatot, melynek itt találod a feladatleírását. Dolgozhatsz ugyanabba a projektbe. Minden leckéhez hozz létre külön csomagot! Figyelj, hogy a minden leckéhez vannak tesztesetek, ezeket másold be a projektedbe!
10+
11+
## Tartalomjegyzék
12+
13+
* [ioreadstring - Szöveges állomány beolvasása](examples/ioreadstring/README.md)
14+
* [iowritestring - String kiírása szöveges állományba](examples/iowritestring/README.md)
15+
* [ioreadwritebytes - Bájtos beolvasása fájlból és kiírása fájlba](examples/ioreadwritebytes/README.md)
16+
* [ioreader - String olvasása Readerrel](examples/ioreader/README.md)
17+
* [iowriter - String írása Writerrel](examples/iowriter/README.md)
18+
* [ioprintwriter - Különböző típusok írása PrintWriterrel](examples/ioprintwriter/README.md)
19+
* [iostringwriter - Kiírás Stringbe StringWriterrel](examples/iostringwriter/README.md)
20+
* [ioreadbytes - Bájtok olvasása InputStreammel](examples/ioreadbytes/README.md)
21+
* [ioreaderclasspath - String olvasása classpath-ról](examples/ioreaderclasspath/README.md)
22+
* [iowritebytes - Bájtok írása OutputStreammel](examples/iowritebytes/README.md)
23+
* [iodatastream - Adatok írása OutputStreamre, és olvasás](examples/iodatastream/README.md)
24+
* [iozip - Bájtok írása tömörítéssel](examples/iozip/README.md)
25+
* [ioconvert - Konvertálás a típusok között](examples/ioconvert/README.md)
26+
* [iofiles - Files osztály használata](examples/iofiles/README.md)
27+
* [iofilestest - Fájlkezelés tesztelése](examples/iofilestest/README.md)
28+
* [genericsusage - Generikusok használata, diamond operátor](examples/genericsusage/README.md)
29+
* [collectionsequalshash - equals, hashCode](examples/collectionsequalshash/README.md)
30+
* [collectionslist - List, ArrayList kontra LinkedList](examples/collectionslist/README.md)
31+
* [collectionsset - Set](examples/collectionsset/README.md)
32+
* [collectionsqueue - Queue](examples/collectionsqueue/README.md)
33+
* [collectionsmap - Map](examples/collectionsmap/README.md)
34+
* [collectionsautoboxing - Autoboxing használata kollekcióknál](examples/collectionsautoboxing/README.md)
35+
* [collectionsiterator - Bejárás](examples/collectionsiterator/README.md)
36+
* [collectionscomp - Comparable és Comparator](examples/collectionscomp/README.md)
37+
* [searching - Keresés](examples/searching/README.md)
38+
* [sorting - Rendezés](examples/sorting/README.md)
39+
* [collectionsclass - Collections osztály (keresésen, rendezésen felüli metódusok)](examples/collectionsclass/README.md)
40+
* [clone - A clone() metódus, deep clone](examples/clone/README.md)
41+
* [properties - Properties állományok](examples/properties/README.md)
42+
* [lambdaintro - Bevezetés a lambda kifejezések használatába](examples/lambdaintro/README.md)
43+
* [lambdaoptional - Optional használata](examples/lambdaoptional/README.md)
44+
* [lambdacomparator - Comparator módosítások](examples/lambdacomparator/README.md)
45+
* [lambdastreams - Streamek](examples/lambdastreams/README.md)
46+
* [lambdaintermediate - Intermediate műveletek](examples/lambdaintermediate/README.md)
47+
* [lambdaprimitives - Primitívek használata streamekben](examples/lambdaprimitives/README.md)
48+
* [lambdacollectors - Collectors](examples/lambdacollectors/README.md)
49+
* [datenewtypes - Új típusok, LocalDate, LocalTime, parse](examples/datenewtypes/README.md)
50+
* [dateoldtypes - Régi dátum- és időkezeléssel kapcsolatos típusok](examples/dateoldtypes/README.md)
51+
* [jvm - JVM](examples/jvm/README.md)
52+
* [thirdparty - Third party library-k](examples/thirdparty/README.md)
53+
* [logging - Naplózás](examples/logging/README.md)
54+
* [dpintro - Bevezetés a tervezési minták használatába](examples/dpintro/README.md)
55+
* [solid - S.O.L.I.D. elvek](examples/solid/README.md)
56+
* [singleton - Singleton tervezési minta](examples/singleton/README.md)
57+
* [builder - Builder tervezési minta](examples/builder/README.md)
58+
* [templatemethod - Template method tervezési minta](examples/templatemethod/README.md)
59+
* [simplefactory - Simple factory tervezési minta](examples/simplefactory/README.md)
60+
61+
## Java fejlesztőeszközök
62+
63+
Ellenőrizd, lehet, hogy a gépeden már előre van telepítve a
64+
Java SE Development Kit!
65+
66+
Nézd meg a `C:\Program Files\Java` könyvtárat!
67+
68+
A Java SE Development Kit már nem állítja be sem a `JAVA_HOME`
69+
környezeti változót, sem a `PATH`-t, ezért
70+
kézzel kell beállítani a környezeti változók között.
71+
72+
Ez ettől függetlenül nem szükséges, mert a
73+
Java SE Development Kitet kizárólag fejlesztőkörnyezetből
74+
használjuk, parancssorból nem.
75+
76+
Amennyiben mégis be kell állítani, a következő kettőt kell:
77+
78+
```
79+
JAVA_HOME=C:\Program Files\Java\jdk-12.0.0
80+
```
81+
82+
Valamint módosítani kell a `PATH` környezeti változó
83+
értékét, fel kell venni egy új sort:
84+
85+
```
86+
%JAVA_HOME%\bin
87+
```

demos/pom.xml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<groupId>com.training360.yellowroad</groupId>
7+
<artifactId>yellowroad-java-demos</artifactId>
8+
<version>1.0-SNAPSHOT</version>
9+
10+
<name>${project.artifactId}</name>
11+
12+
<scm>
13+
<connection>scm:git:https://github.com/Training360/yellowroad-java</connection>
14+
<developerConnection>scm:git:https://github.com/Training360/yellowroad-java</developerConnection>
15+
<url>scm:git:https://github.com/Training360/yellowroad-java</url>
16+
</scm>
17+
18+
<properties>
19+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
20+
<maven.compiler.source>12</maven.compiler.source>
21+
<maven.compiler.target>12</maven.compiler.target>
22+
</properties>
23+
24+
<dependencies>
25+
<dependency>
26+
<groupId>junit</groupId>
27+
<artifactId>junit</artifactId>
28+
<version>4.12</version>
29+
<scope>test</scope>
30+
</dependency>
31+
<dependency>
32+
<groupId>org.hamcrest</groupId>
33+
<artifactId>hamcrest-all</artifactId>
34+
<version>1.3</version>
35+
<scope>test</scope>
36+
</dependency>
37+
</dependencies>
38+
39+
</project>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package builder;
2+
3+
public class Trainer {
4+
private String name;
5+
6+
private int age;
7+
8+
public Trainer(String name, int age) {
9+
this.name = name;
10+
this.age = age;
11+
}
12+
13+
public String getName() {
14+
return name;
15+
}
16+
17+
public int getAge() {
18+
return age;
19+
}
20+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package builder;
2+
3+
public class TrainerBuilder {
4+
5+
private String name = "anonymous";
6+
7+
private int age = -1;
8+
9+
public TrainerBuilder withName(String name) {
10+
this.name = name;
11+
return this;
12+
}
13+
14+
public TrainerBuilder withAge(int age) {
15+
if (age < 18) {
16+
throw new IllegalArgumentException("Invalid age :" + age);
17+
}
18+
this.age = age;
19+
return this;
20+
}
21+
22+
public TrainerBuilder withAge(String age) {
23+
withAge(Integer.parseInt(age));
24+
return this;
25+
}
26+
27+
public Trainer build() {
28+
if (age == -1) {
29+
throw new IllegalStateException("Missing age");
30+
}
31+
return new Trainer(name, age);
32+
}
33+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
package clone;
2+
3+
import java.time.LocalDateTime;
4+
5+
public class Auction {
6+
7+
private int price;
8+
9+
private LocalDateTime start;
10+
11+
private User user;
12+
13+
private Product product;
14+
15+
public Auction(int price, LocalDateTime start, User user, Product product) {
16+
this.price = price;
17+
this.start = start;
18+
this.user = user;
19+
this.product = product;
20+
}
21+
22+
public Auction(Auction another) {
23+
price = another.price;
24+
start = another.start;
25+
user = another.user;
26+
product = new Product(another.product);
27+
}
28+
29+
public int getPrice() {
30+
return price;
31+
}
32+
33+
public void setPrice(int price) {
34+
this.price = price;
35+
}
36+
37+
public LocalDateTime getStart() {
38+
return start;
39+
}
40+
41+
public void setStart(LocalDateTime start) {
42+
this.start = start;
43+
}
44+
45+
public User getUser() {
46+
return user;
47+
}
48+
49+
public void setUser(User user) {
50+
this.user = user;
51+
}
52+
53+
public Product getProduct() {
54+
return product;
55+
}
56+
57+
public void setProduct(Product product) {
58+
this.product = product;
59+
}
60+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package clone;
2+
3+
public class Product {
4+
5+
private String name;
6+
7+
public Product(String name) {
8+
this.name = name;
9+
}
10+
11+
public Product(Product another) {
12+
this.name = another.name;
13+
}
14+
15+
public String getName() {
16+
return name;
17+
}
18+
19+
public void setName(String name) {
20+
this.name = name;
21+
}
22+
}

demos/src/main/java/clone/User.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package clone;
2+
3+
public class User {
4+
5+
private String name;
6+
7+
public User(String name) {
8+
this.name = name;
9+
}
10+
11+
public String getName() {
12+
return name;
13+
}
14+
15+
public void setName(String name) {
16+
this.name = name;
17+
}
18+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package collectionscomp;
2+
3+
import java.util.Objects;
4+
5+
public class Trainer implements Comparable<Trainer> {
6+
7+
private String name;
8+
9+
private int salary;
10+
11+
public Trainer(String name, int salary) {
12+
this.name = name;
13+
this.salary = salary;
14+
}
15+
16+
public String getName() {
17+
return name;
18+
}
19+
20+
public int getSalary() {
21+
return salary;
22+
}
23+
24+
@Override
25+
public int compareTo(Trainer o) {
26+
return this.name.compareTo(o.name);
27+
//return this.salary - o.salary;
28+
}
29+
30+
@Override
31+
public boolean equals(Object o) {
32+
if (this == o) return true;
33+
if (o == null || getClass() != o.getClass()) return false;
34+
Trainer trainer = (Trainer) o;
35+
//return this.name.equals(trainer.name);
36+
return salary == trainer.salary;
37+
}
38+
39+
@Override
40+
public int hashCode() {
41+
42+
return Objects.hash(salary);
43+
}
44+
45+
@Override
46+
public String toString() {
47+
return "Trainer{" +
48+
"name='" + name + '\'' +
49+
", salary=" + salary +
50+
'}';
51+
}
52+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package collectionsequalshash;
2+
3+
import java.util.Objects;
4+
5+
public class Trainer {
6+
7+
private String name;
8+
9+
private int year;
10+
11+
public Trainer(String name, int year) {
12+
this.name = name;
13+
this.year = year;
14+
}
15+
16+
public String getName() {
17+
return name;
18+
}
19+
20+
public int getYear() {
21+
return year;
22+
}
23+
24+
@Override
25+
public boolean equals(Object o) {
26+
if (this == o) return true;
27+
if (o == null || getClass() != o.getClass()) return false;
28+
Trainer trainer = (Trainer) o;
29+
return year == trainer.year &&
30+
Objects.equals(name, trainer.name);
31+
}
32+
33+
@Override
34+
public int hashCode() {
35+
36+
return Objects.hash(name, year);
37+
}
38+
}

0 commit comments

Comments
 (0)