[JAVA-9421] Cleanup code present in stackify repo (#11709)
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.stackify</groupId>
|
||||
<artifactId>core-java-9</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>core-java-9</name>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-modules</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>${maven-compiler-plugin.version}</version>
|
||||
<configuration>
|
||||
<source>${maven.compiler.source}</source>
|
||||
<target>${maven.compiler.target}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>1.9</maven.compiler.source>
|
||||
<maven.compiler.target>1.9</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.stackify.optional;
|
||||
|
||||
public class User {
|
||||
private String email;
|
||||
private String password;
|
||||
|
||||
public User(String email, String password) {
|
||||
super();
|
||||
this.email = email;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
|
||||
</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
</configuration>
|
||||
@@ -1,41 +0,0 @@
|
||||
package com.stackify.optional;
|
||||
|
||||
import org.junit.Test;
|
||||
import java.util.Optional;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class OptionalTest {
|
||||
|
||||
private User user;
|
||||
|
||||
@Test
|
||||
public void whenEmptyOptional_thenGetValueFromOr() {
|
||||
User result = Optional.ofNullable(user)
|
||||
.or( () -> Optional.of(new User("default","1234"))).get();
|
||||
|
||||
assertEquals(result.getEmail(), "default");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenIfPresentOrElse_thenOk() {
|
||||
Optional.ofNullable(user)
|
||||
.ifPresentOrElse( u -> System.out.println("User is:" + u.getEmail()), () -> System.out.println("User not found"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenGetStream_thenOk() {
|
||||
User user = new User("[email protected]", "1234");
|
||||
List<String> emails = Optional.ofNullable(user)
|
||||
.stream()
|
||||
.filter(u -> u.getEmail() != null && u.getEmail().contains("@"))
|
||||
.map( u -> u.getEmail())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
assertTrue(emails.size() == 1);
|
||||
assertEquals(emails.get(0), user.getEmail());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.stackify</groupId>
|
||||
<artifactId>core-java</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>core-java</name>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-modules</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>${log4j2.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
<log4j2.version>2.8.2</log4j2.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
@@ -1,40 +0,0 @@
|
||||
package com.stackify.optional;
|
||||
|
||||
public class Address {
|
||||
private String addressLine;
|
||||
private String city;
|
||||
private Country country;
|
||||
|
||||
public Address(String addressLine, String city, Country country) {
|
||||
super();
|
||||
this.addressLine = addressLine;
|
||||
this.city = city;
|
||||
this.country = country;
|
||||
}
|
||||
|
||||
public String getAddressLine() {
|
||||
return addressLine;
|
||||
}
|
||||
|
||||
public void setAddressLine(String addressLine) {
|
||||
this.addressLine = addressLine;
|
||||
}
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public Country getCountry() {
|
||||
return country;
|
||||
}
|
||||
|
||||
public void setCountry(Country country) {
|
||||
this.country = country;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.stackify.optional;
|
||||
|
||||
public class Country {
|
||||
private String name;
|
||||
private String isocode;
|
||||
|
||||
public Country(String name, String isocode) {
|
||||
super();
|
||||
this.name = name;
|
||||
this.isocode = isocode;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getIsocode() {
|
||||
return isocode;
|
||||
}
|
||||
|
||||
public void setIsocode(String isocode) {
|
||||
this.isocode = isocode;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
package com.stackify.optional;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class User {
|
||||
private String email;
|
||||
private String password;
|
||||
|
||||
private Address address;
|
||||
|
||||
private String position;
|
||||
|
||||
public User(String email, String password) {
|
||||
super();
|
||||
this.email = email;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public Address getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(Address address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public Optional<String> getPosition() {
|
||||
return Optional.ofNullable(position);
|
||||
}
|
||||
|
||||
public void setPosition(String position) {
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package com.stackify.optional.chaining;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class Address {
|
||||
private String addressLine;
|
||||
private String city;
|
||||
private Country country;
|
||||
|
||||
public Address(String addressLine, String city) {
|
||||
this.addressLine = addressLine;
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getAddressLine() {
|
||||
return addressLine;
|
||||
}
|
||||
|
||||
public void setAddressLine(String addressLine) {
|
||||
this.addressLine = addressLine;
|
||||
}
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public Optional<Country> getCountry() {
|
||||
return Optional.ofNullable(country);
|
||||
}
|
||||
|
||||
public void setCountry(Country country) {
|
||||
this.country = country;
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.stackify.optional.chaining;
|
||||
|
||||
public class Country {
|
||||
private String name;
|
||||
private String isocode;
|
||||
|
||||
public Country(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getIsocode() {
|
||||
return isocode;
|
||||
}
|
||||
|
||||
public void setIsocode(String isocode) {
|
||||
this.isocode = isocode;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package com.stackify.optional.chaining;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class User {
|
||||
private String email;
|
||||
private String password;
|
||||
|
||||
private Address address;
|
||||
|
||||
private String position;
|
||||
|
||||
public User(String email, String password) {
|
||||
this.email = email;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public Optional<Address> getAddress() {
|
||||
return Optional.ofNullable(address);
|
||||
}
|
||||
|
||||
public void setAddress(Address address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public Optional<String> getPosition() {
|
||||
return Optional.ofNullable(position);
|
||||
}
|
||||
|
||||
public void setPosition(String position) {
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package com.stackify.optionalparams;
|
||||
|
||||
public class MultiVitamin {
|
||||
|
||||
private String name; // required
|
||||
private int vitaminA; // in mcg
|
||||
private int vitaminC; // in mg
|
||||
private int calcium; // in mg
|
||||
private int iron; // in mg
|
||||
|
||||
public MultiVitamin(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getVitaminA() {
|
||||
return vitaminA;
|
||||
}
|
||||
|
||||
public void setVitaminA(int vitaminA) {
|
||||
this.vitaminA = vitaminA;
|
||||
}
|
||||
|
||||
public int getVitaminC() {
|
||||
return vitaminC;
|
||||
}
|
||||
|
||||
public void setVitaminC(int vitaminC) {
|
||||
this.vitaminC = vitaminC;
|
||||
}
|
||||
|
||||
public int getCalcium() {
|
||||
return calcium;
|
||||
}
|
||||
|
||||
public void setCalcium(int calcium) {
|
||||
this.calcium = calcium;
|
||||
}
|
||||
|
||||
public int getIron() {
|
||||
return iron;
|
||||
}
|
||||
|
||||
public void setIron(int iron) {
|
||||
this.iron = iron;
|
||||
}
|
||||
}
|
||||
-38
@@ -1,38 +0,0 @@
|
||||
package com.stackify.optionalparams;
|
||||
|
||||
public class MultiVitaminAllowingNulls {
|
||||
|
||||
private String name; // required
|
||||
private Integer vitaminA; // in mcg
|
||||
private Integer vitaminC; // in mg
|
||||
private Integer calcium; // in mg
|
||||
private Integer iron; // in mg
|
||||
|
||||
public MultiVitaminAllowingNulls(String name, Integer vitaminA, Integer vitaminC, Integer calcium, Integer iron) {
|
||||
this.name = name;
|
||||
this.vitaminA = vitaminA;
|
||||
this.vitaminC = vitaminC;
|
||||
this.calcium = calcium;
|
||||
this.iron = iron;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Integer getVitaminA() {
|
||||
return vitaminA;
|
||||
}
|
||||
|
||||
public Integer getVitaminC() {
|
||||
return vitaminC;
|
||||
}
|
||||
|
||||
public Integer getCalcium() {
|
||||
return calcium;
|
||||
}
|
||||
|
||||
public Integer getIron() {
|
||||
return iron;
|
||||
}
|
||||
}
|
||||
-56
@@ -1,56 +0,0 @@
|
||||
package com.stackify.optionalparams;
|
||||
|
||||
public class MultiVitaminOverloading {
|
||||
|
||||
static final int DEFAULT_IRON_AMOUNT = 20;
|
||||
|
||||
private final String name; // required
|
||||
private final int vitaminA; // in mcg
|
||||
private final int vitaminC; // in mg
|
||||
private final int calcium; // in mg
|
||||
private final int iron; // in mg
|
||||
|
||||
public MultiVitaminOverloading(String name) {
|
||||
this(name, 0);
|
||||
}
|
||||
|
||||
public MultiVitaminOverloading(String name, int vitaminA) {
|
||||
this(name, vitaminA, 0);
|
||||
}
|
||||
|
||||
public MultiVitaminOverloading(String name, int vitaminA, int vitaminC) {
|
||||
this(name, vitaminA, vitaminC, 0);
|
||||
}
|
||||
|
||||
public MultiVitaminOverloading(String name, int vitaminA, int vitaminC, int calcium) {
|
||||
this(name, vitaminA, vitaminC, calcium, DEFAULT_IRON_AMOUNT);
|
||||
}
|
||||
|
||||
public MultiVitaminOverloading(String name, int vitaminA, int vitaminC, int calcium, int iron) {
|
||||
this.name = name;
|
||||
this.vitaminA = vitaminA;
|
||||
this.vitaminC = vitaminC;
|
||||
this.calcium = calcium;
|
||||
this.iron = iron;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getVitaminA() {
|
||||
return vitaminA;
|
||||
}
|
||||
|
||||
public int getVitaminC() {
|
||||
return vitaminC;
|
||||
}
|
||||
|
||||
public int getCalcium() {
|
||||
return calcium;
|
||||
}
|
||||
|
||||
public int getIron() {
|
||||
return iron;
|
||||
}
|
||||
}
|
||||
-52
@@ -1,52 +0,0 @@
|
||||
package com.stackify.optionalparams;
|
||||
|
||||
public class MultiVitaminStaticFactoryMethods {
|
||||
|
||||
static final int IRON_AMT_DEF = 20;
|
||||
static final int IRON_AMT_MEN = 30;
|
||||
|
||||
static final int CALCIUM_AMT_DEF = 100;
|
||||
static final int CALCIUM_AMT_WOMEN = 120;
|
||||
|
||||
private final String name; // required
|
||||
private final int vitaminA; // in mcg
|
||||
private final int vitaminC; // in mg
|
||||
private final int calcium; // in mg
|
||||
private final int iron; // in mg
|
||||
|
||||
public static MultiVitaminStaticFactoryMethods forMen(String name) {
|
||||
return new MultiVitaminStaticFactoryMethods(name, 5000, 60, CALCIUM_AMT_DEF, IRON_AMT_MEN);
|
||||
}
|
||||
|
||||
public static MultiVitaminStaticFactoryMethods forWomen(String name) {
|
||||
return new MultiVitaminStaticFactoryMethods(name, 5000, 60, CALCIUM_AMT_WOMEN, IRON_AMT_DEF);
|
||||
}
|
||||
|
||||
private MultiVitaminStaticFactoryMethods(String name, int vitaminA, int vitaminC, int calcium, int iron) {
|
||||
this.name = name;
|
||||
this.vitaminA = vitaminA;
|
||||
this.vitaminC = vitaminC;
|
||||
this.calcium = calcium;
|
||||
this.iron = iron;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getVitaminA() {
|
||||
return vitaminA;
|
||||
}
|
||||
|
||||
public int getVitaminC() {
|
||||
return vitaminC;
|
||||
}
|
||||
|
||||
public int getCalcium() {
|
||||
return calcium;
|
||||
}
|
||||
|
||||
public int getIron() {
|
||||
return iron;
|
||||
}
|
||||
}
|
||||
-77
@@ -1,77 +0,0 @@
|
||||
package com.stackify.optionalparams;
|
||||
|
||||
public class MultiVitaminWithBuilder {
|
||||
|
||||
private final String name; // required
|
||||
private final int vitaminA; // in mcg
|
||||
private final int vitaminC; // in mg
|
||||
private final int calcium; // in mg
|
||||
private final int iron; // in mg
|
||||
|
||||
private MultiVitaminWithBuilder(MultiVitaminBuilder builder) {
|
||||
this.name = builder.name;
|
||||
this.vitaminA = builder.vitaminA;
|
||||
this.vitaminC = builder.vitaminC;
|
||||
this.calcium = builder.calcium;
|
||||
this.iron = builder.iron;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getVitaminA() {
|
||||
return vitaminA;
|
||||
}
|
||||
|
||||
public int getVitaminC() {
|
||||
return vitaminC;
|
||||
}
|
||||
|
||||
public int getCalcium() {
|
||||
return calcium;
|
||||
}
|
||||
|
||||
public int getIron() {
|
||||
return iron;
|
||||
}
|
||||
|
||||
public static class MultiVitaminBuilder {
|
||||
|
||||
private static final int ZERO = 0;
|
||||
|
||||
private final String name; // required
|
||||
private int vitaminA = ZERO;
|
||||
private int vitaminC = ZERO;
|
||||
private int calcium = ZERO;
|
||||
private int iron = ZERO;
|
||||
|
||||
public MultiVitaminBuilder(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public MultiVitaminBuilder withVitaminA(int vitaminA) {
|
||||
this.vitaminA = vitaminA;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MultiVitaminBuilder withVitaminC(int vitaminC) {
|
||||
this.vitaminC = vitaminC;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MultiVitaminBuilder withCalcium(int calcium) {
|
||||
this.calcium = calcium;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MultiVitaminBuilder withIron(int iron) {
|
||||
this.iron = iron;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MultiVitaminWithBuilder build() {
|
||||
return new MultiVitaminWithBuilder(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package com.stackify.stream;
|
||||
|
||||
public class Employee {
|
||||
private Integer id;
|
||||
private String name;
|
||||
private Double salary;
|
||||
|
||||
public Employee(Integer id, String name, Double salary) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.salary = salary;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Double getSalary() {
|
||||
return salary;
|
||||
}
|
||||
|
||||
public void setSalary(Double salary) {
|
||||
this.salary = salary;
|
||||
}
|
||||
|
||||
public void salaryIncrement(Double percentage) {
|
||||
Double newSalary = salary + percentage * salary / 100;
|
||||
setSalary(newSalary);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "Id: " + id + " Name:" + name + " Price:" + salary;
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.stackify.stream;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class EmployeeRepository {
|
||||
private List<Employee> empList;
|
||||
|
||||
public EmployeeRepository(List<Employee> empList) {
|
||||
this.empList = empList;
|
||||
|
||||
}
|
||||
public Employee findById(Integer id) {
|
||||
for (Employee emp : empList) {
|
||||
if (emp.getId() == id) {
|
||||
return emp;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Configuration status="WARN">
|
||||
<Appenders>
|
||||
<Console name="Console" target="SYSTEM_OUT">
|
||||
<PatternLayout pattern="%msg%n" />
|
||||
</Console>
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<Root level="info">
|
||||
<AppenderRef ref="Console" />
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
||||
@@ -1,166 +0,0 @@
|
||||
package com.stackify.optional;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.junit.Test;
|
||||
|
||||
public class OptionalTest {
|
||||
|
||||
private User user;
|
||||
|
||||
private Logger logger = LogManager.getLogger(OptionalTest.class);
|
||||
|
||||
@Test(expected = NullPointerException.class)
|
||||
public void testNull() {
|
||||
String isocode = user.getAddress().getCountry().getIsocode().toUpperCase();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
|
||||
if (user != null) {
|
||||
Address address = user.getAddress();
|
||||
if (address != null) {
|
||||
Country country = address.getCountry();
|
||||
if (country != null) {
|
||||
String isocode = country.getIsocode();
|
||||
if (isocode != null) {
|
||||
isocode = isocode.toUpperCase();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test(expected = NoSuchElementException.class)
|
||||
public void whenCreateEmptyOptional_thenNull() {
|
||||
Optional<User> emptyOpt = Optional.empty();
|
||||
emptyOpt.get();
|
||||
}
|
||||
|
||||
@Test(expected = NullPointerException.class)
|
||||
public void whenCreateOfEmptyOptional_thenNullPointerException() {
|
||||
Optional<User> opt = Optional.of(user);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenCreateOfNullableOptional_thenOk() {
|
||||
String name = "John";
|
||||
Optional<String> opt = Optional.ofNullable(name);
|
||||
assertEquals("John", opt.get());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenCheckIsPresent_thenOk() {
|
||||
user = new User("[email protected]", "1234");
|
||||
Optional<User> opt = Optional.ofNullable(user);
|
||||
assertTrue(opt.isPresent());
|
||||
|
||||
assertEquals(user.getEmail(), opt.get().getEmail());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenCheckIfPresent_thenOk() {
|
||||
user = new User("[email protected]", "1234");
|
||||
Optional<User> opt = Optional.ofNullable(user);
|
||||
assertTrue(opt.isPresent());
|
||||
|
||||
opt.ifPresent(u -> assertEquals(user.getEmail(), u.getEmail()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenEmptyValue_thenReturnDefault() {
|
||||
User user = null;
|
||||
User user2 = new User("[email protected]", "1234");
|
||||
User result = Optional.ofNullable(user).orElse(user2);
|
||||
|
||||
assertEquals("[email protected]", result.getEmail());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenValueNotNull_thenIgnoreDefault() {
|
||||
User user = new User("[email protected]", "1234");
|
||||
User user2 = new User("[email protected]", "1234");
|
||||
User result = Optional.ofNullable(user).orElse(user2);
|
||||
|
||||
assertEquals("[email protected]", result.getEmail());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenSetDefaultOrElseGet_thenOk() {
|
||||
User user = null;
|
||||
User user2 = new User("[email protected]", "1234");
|
||||
User result = Optional.ofNullable(user).orElseGet(() -> user2);
|
||||
|
||||
assertEquals("[email protected]", result.getEmail());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenPresentValue_whenCompare_thenOk() {
|
||||
User user = new User("[email protected]", "1234");
|
||||
logger.info("Using orElse");
|
||||
User result = Optional.ofNullable(user).orElse(createNewUser());
|
||||
logger.info("Using orElseGet");
|
||||
User result2 = Optional.ofNullable(user).orElseGet(() -> createNewUser());
|
||||
}
|
||||
|
||||
private User createNewUser() {
|
||||
logger.info("Creating New User");
|
||||
return new User("[email protected]", "1234");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenEmptyValue_whenCompare_thenOk() {
|
||||
User user = null;
|
||||
logger.info("Using orElse");
|
||||
User result = Optional.ofNullable(user).orElse(createNewUser());
|
||||
logger.info("Using orElseGet");
|
||||
User result2 = Optional.ofNullable(user).orElseGet(() -> createNewUser());
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void whenThrowException_thenOk() {
|
||||
User result = Optional.ofNullable(user).orElseThrow(() -> new IllegalArgumentException());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenMap_thenOk() {
|
||||
user = new User("[email protected]", "1234");
|
||||
String email = Optional.ofNullable(user).map(u -> u.getEmail()).orElse("[email protected]");
|
||||
assertEquals(email, user.getEmail());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenFlatMap_thenOk() {
|
||||
user = new User("[email protected]", "1234");
|
||||
user.setPosition("Developer");
|
||||
String position = Optional.ofNullable(user).flatMap(u -> u.getPosition()).orElse("default");
|
||||
assertEquals(position, user.getPosition().get());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenFilter_thenOk() {
|
||||
user = new User("[email protected]", "1234");
|
||||
Optional<User> result = Optional.ofNullable(user).filter(u -> u.getEmail() != null && u.getEmail().contains("@"));
|
||||
|
||||
assertTrue(result.isPresent());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenStream_thenOk() {
|
||||
List<User> users = new ArrayList<>();
|
||||
User user = users.stream().findFirst().orElse(new User("default", "1234"));
|
||||
assertEquals(user.getEmail(), "default");
|
||||
}
|
||||
|
||||
}
|
||||
-36
@@ -1,36 +0,0 @@
|
||||
package com.stackify.optional.chaining;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class OptionalChainingTest {
|
||||
|
||||
@Test
|
||||
public void whenChaining_thenOk() {
|
||||
User user = new User("[email protected]", "1234");
|
||||
|
||||
String result = Optional.ofNullable(user)
|
||||
.flatMap(u -> u.getAddress())
|
||||
.flatMap(a -> a.getCountry())
|
||||
.map(c -> c.getIsocode())
|
||||
.orElse("default");
|
||||
|
||||
assertEquals(result, "default");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenChainingWithMethodReferences_thenOk() {
|
||||
User user = new User("[email protected]", "1234");
|
||||
|
||||
String result = Optional.ofNullable(user)
|
||||
.flatMap(User::getAddress)
|
||||
.flatMap(Address::getCountry)
|
||||
.map(Country::getIsocode)
|
||||
.orElse("default");
|
||||
|
||||
assertEquals(result, "default");
|
||||
}
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
package com.stackify.optionalparams;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.assertj.core.util.Arrays;
|
||||
import org.junit.Test;
|
||||
|
||||
public class OptionalParamsUnitTest {
|
||||
|
||||
@Test
|
||||
public void whenCreateMultiVitaminWithOverloading_thenOk() {
|
||||
MultiVitaminOverloading multiVitamin = new MultiVitaminOverloading("Default Multivitamin");
|
||||
|
||||
assertThat(multiVitamin.getName()).isEqualTo("Default Multivitamin");
|
||||
assertThat(multiVitamin.getVitaminA()).isEqualTo(0);
|
||||
assertThat(multiVitamin.getVitaminC()).isEqualTo(0);
|
||||
assertThat(multiVitamin.getCalcium()).isEqualTo(0);
|
||||
assertThat(multiVitamin.getIron()).isEqualTo(MultiVitaminOverloading.DEFAULT_IRON_AMOUNT);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenCreateMultiVitaminWithStaticFactoryMethods_thenOk() {
|
||||
MultiVitaminStaticFactoryMethods mensMultiVitamin = MultiVitaminStaticFactoryMethods.forMen("Complete for Men");
|
||||
|
||||
assertThat(mensMultiVitamin.getName()).isEqualTo("Complete for Men");
|
||||
assertThat(mensMultiVitamin.getCalcium()).isEqualTo(MultiVitaminStaticFactoryMethods.CALCIUM_AMT_DEF);
|
||||
assertThat(mensMultiVitamin.getIron()).isEqualTo(MultiVitaminStaticFactoryMethods.IRON_AMT_MEN);
|
||||
|
||||
MultiVitaminStaticFactoryMethods womensMultiVitamin = MultiVitaminStaticFactoryMethods.forWomen("Complete for Women");
|
||||
|
||||
assertThat(womensMultiVitamin.getName()).isEqualTo("Complete for Women");
|
||||
assertThat(womensMultiVitamin.getCalcium()).isEqualTo(MultiVitaminStaticFactoryMethods.CALCIUM_AMT_WOMEN);
|
||||
assertThat(womensMultiVitamin.getIron()).isEqualTo(MultiVitaminStaticFactoryMethods.IRON_AMT_DEF);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenCreateMultiVitaminWithBuilder_thenOk() {
|
||||
MultiVitaminWithBuilder vitamin = new MultiVitaminWithBuilder.MultiVitaminBuilder("Maximum Strength")
|
||||
.withCalcium(100)
|
||||
.withIron(200)
|
||||
.withVitaminA(50)
|
||||
.withVitaminC(1000)
|
||||
.build();
|
||||
|
||||
assertThat(vitamin.getName()).isEqualTo("Maximum Strength");
|
||||
assertThat(vitamin.getCalcium()).isEqualTo(100);
|
||||
assertThat(vitamin.getIron()).isEqualTo(200);
|
||||
assertThat(vitamin.getVitaminA()).isEqualTo(50);
|
||||
assertThat(vitamin.getVitaminC()).isEqualTo(1000);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenCreateMutliVitaminWithAccessors_thenOk() {
|
||||
MultiVitamin vitamin = new MultiVitamin("Generic");
|
||||
vitamin.setVitaminA(50);
|
||||
vitamin.setVitaminC(1000);
|
||||
vitamin.setCalcium(100);
|
||||
vitamin.setIron(200);
|
||||
|
||||
assertThat(vitamin.getName()).isEqualTo("Generic");
|
||||
assertThat(vitamin.getCalcium()).isEqualTo(100);
|
||||
assertThat(vitamin.getIron()).isEqualTo(200);
|
||||
assertThat(vitamin.getVitaminA()).isEqualTo(50);
|
||||
assertThat(vitamin.getVitaminC()).isEqualTo(1000);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenCreateMultiVitaminWithNulls_thenOk() {
|
||||
MultiVitamin vitamin = new MultiVitamin(null);
|
||||
|
||||
assertThat(vitamin.getName()).isNull();
|
||||
}
|
||||
|
||||
public void varArgsDemo() {
|
||||
Object[] args = Arrays.array(Long.valueOf(1), Integer.valueOf(2), BigDecimal.valueOf(3));
|
||||
|
||||
processVarArgsWithCastingAntiPattern(args);
|
||||
}
|
||||
|
||||
private void processVarArgsWithCastingAntiPattern(Object... args) {
|
||||
String message = "processing %s as %s";
|
||||
|
||||
// never do this sort of thing
|
||||
for (Object arg : args) {
|
||||
if (arg instanceof Long) {
|
||||
System.out.println(String.format(message, arg, "Long"));
|
||||
} else if (arg instanceof Integer) {
|
||||
System.out.println(String.format(message, arg, "Integer"));
|
||||
} else if (arg instanceof BigDecimal) {
|
||||
System.out.println(String.format(message, arg, "BigDecimal"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,14 +0,0 @@
|
||||
/bin/
|
||||
|
||||
#ignore gradle
|
||||
.gradle/
|
||||
|
||||
|
||||
#ignore build and generated files
|
||||
build/
|
||||
node/
|
||||
out/
|
||||
|
||||
#ignore installed node modules and package lock file
|
||||
node_modules/
|
||||
package-lock.json
|
||||
@@ -1,201 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.stackify</groupId>
|
||||
<artifactId>core-kotlin</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>core-kotlin</name>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>jcenter</id>
|
||||
<url>http://jcenter.bintray.com</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.junit.platform</groupId>
|
||||
<artifactId>junit-platform-runner</artifactId>
|
||||
<version>${junit-platform.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-stdlib</artifactId>
|
||||
<version>${kotlin-stdlib.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-stdlib-jdk8</artifactId>
|
||||
<version>${kotlin-stdlib.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-test-junit</artifactId>
|
||||
<version>${kotlin-test-junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-reflect</artifactId>
|
||||
<version>${kotlin-reflect.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.spek</groupId>
|
||||
<artifactId>spek-api</artifactId>
|
||||
<version>${spek.api.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.spek</groupId>
|
||||
<artifactId>spek-subject-extension</artifactId>
|
||||
<version>${spek.subject.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.spek</groupId>
|
||||
<artifactId>spek-junit-platform-engine</artifactId>
|
||||
<version>${spek.junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.nhaarman</groupId>
|
||||
<artifactId>mockito-kotlin</artifactId>
|
||||
<version>${mockito-kotlin.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.assertj</groupId>
|
||||
<artifactId>assertj-core</artifactId>
|
||||
<version>${assertj.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>${maven-compiler-plugin.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-failsafe-plugin</artifactId>
|
||||
<version>${maven-failsafe-plugin.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-maven-plugin</artifactId>
|
||||
<version>${kotlin-maven-plugin.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-maven-plugin</artifactId>
|
||||
<version>${kotlin-maven-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>compile</id>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sourceDirs>
|
||||
<sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
|
||||
</sourceDirs>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>test-compile</id>
|
||||
<goals>
|
||||
<goal>test-compile</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sourceDirs>
|
||||
<sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
|
||||
</sourceDirs>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>${maven-compiler-plugin.version}</version>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
</configuration>
|
||||
<executions>
|
||||
<!-- Replacing default-compile as it is treated specially
|
||||
by maven -->
|
||||
<execution>
|
||||
<id>default-compile</id>
|
||||
<phase>none</phase>
|
||||
</execution>
|
||||
<!-- Replacing default-testCompile as it is treated specially
|
||||
by maven -->
|
||||
<execution>
|
||||
<id>default-testCompile</id>
|
||||
<phase>none</phase>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>java-compile</id>
|
||||
<phase>compile</phase>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-failsafe-plugin</artifactId>
|
||||
<version>${maven-failsafe-plugin.version}</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.junit.platform</groupId>
|
||||
<artifactId>junit-platform-surefire-provider</artifactId>
|
||||
<version>${junit-platform-surefire-provider.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>junit5</id>
|
||||
<goals>
|
||||
<goal>integration-test</goal>
|
||||
<goal>verify</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<includes>
|
||||
<include>**/*Test5.java</include>
|
||||
</includes>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<properties>
|
||||
<maven-failsafe-plugin.version>2.22.0</maven-failsafe-plugin.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<kotlin-maven-plugin.version>1.2.60</kotlin-maven-plugin.version>
|
||||
<kotlin-test-junit.version>1.2.51</kotlin-test-junit.version>
|
||||
<kotlin-stdlib.version>1.2.51</kotlin-stdlib.version>
|
||||
<kotlin-reflect.version>1.2.51</kotlin-reflect.version>
|
||||
<kotlinx.version>0.22.5</kotlinx.version>
|
||||
<mockito-kotlin.version>1.5.0</mockito-kotlin.version>
|
||||
<commons-math3.version>3.6.1</commons-math3.version>
|
||||
<assertj.version>3.10.0</assertj.version>
|
||||
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
|
||||
<spek.api.version>1.1.5</spek.api.version>
|
||||
<spek.subject.version>1.1.5</spek.subject.version>
|
||||
<spek.junit.version>1.1.5</spek.junit.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.baeldung.kotlinvsjava
|
||||
|
||||
import org.junit.Test
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
class CompanionObjectTest {
|
||||
|
||||
@Test
|
||||
fun givenAClassWithCompanionObject_whenCallingMethodTheSameAsStaticOne_thenWeGetAResult() {
|
||||
assertEquals("A", A.returnClassName())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class A {
|
||||
companion object {
|
||||
fun returnClassName(): String {
|
||||
return "A"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.baeldung.kotlinvsjava
|
||||
|
||||
import org.junit.Test
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
class ConstructorTests {
|
||||
|
||||
@Test
|
||||
fun givenAClassWithPrimaryConstructor_whenCreatingAnInstance_thenWeGetObject() {
|
||||
var example = Example(1, "Example")
|
||||
|
||||
assertEquals(1, example.id)
|
||||
assertEquals("Example", example.name)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Example constructor(val id: Int, var name: String)
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.baeldung.kotlinvsjava
|
||||
|
||||
import org.junit.Test
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertFalse
|
||||
|
||||
class DataClassTest {
|
||||
|
||||
@Test
|
||||
fun givenASampleDataClass_whenCallingToStringMethod_thenItReturnsAllProperties() {
|
||||
val student = Student(1, "John", "Smith")
|
||||
|
||||
assertEquals(1, student.id)
|
||||
assertEquals("John", student.name)
|
||||
assertEquals("Smith", student.lastName)
|
||||
assertEquals("Student(id=1, name=John, lastName=Smith)", student.toString())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun givenASampleDataClass_whenCreatingACopyWithGeneratedFunction_thenItReturnsACopyWithRequestedChanges() {
|
||||
val student = Student(1, "John", "Smith")
|
||||
val student2 = student.copy(id = 2, name = "Anne")
|
||||
|
||||
assertEquals(2, student2.id)
|
||||
assertEquals("Anne", student2.name)
|
||||
assertEquals("Smith", student2.lastName)
|
||||
assertEquals("Student(id=2, name=Anne, lastName=Smith)", student2.toString())
|
||||
assertFalse(student.equals(student2))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
data class Student(val id: Int, val name: String, val lastName: String)
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.baeldung.kotlinvsjava
|
||||
|
||||
import org.junit.Test
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
class DelegationTest {
|
||||
|
||||
@Test
|
||||
fun givenAClassWithDelegation_whenCallDelegatedMethod_thenWeGetAResultDefinedInPassedObject() {
|
||||
val car = Car(V6Engine())
|
||||
|
||||
assertEquals("Vroom", car.makeSound())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
interface Engine {
|
||||
fun makeSound(): String
|
||||
}
|
||||
|
||||
class V6Engine: Engine {
|
||||
override fun makeSound(): String {
|
||||
return "Vroom"
|
||||
}
|
||||
}
|
||||
|
||||
class Car(e: Engine) : Engine by e
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user