Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
4d696cb
Added tasks 1 and 2
shabashoff Oct 25, 2017
6fe42aa
Create branch
shabashoff Oct 27, 2017
120969b
config .gitignore
shabashoff Oct 28, 2017
43f789f
Project fixes
shabashoff Nov 2, 2017
323d164
Fix variables
shabashoff Nov 2, 2017
3aa4ca3
Fix variable names
shabashoff Nov 2, 2017
3365173
Merge branch 'master' of https://github.com/elefus/epam-leti-10-2017 …
shabashoff Nov 2, 2017
b3aa05c
Added task 3
shabashoff Nov 2, 2017
632c856
Added Task 4
shabashoff Nov 2, 2017
e68c35d
Добавлен код с 12 занятия (15.11.2017).
elefus Nov 15, 2017
f4533d1
Added task 5
shabashoff Nov 16, 2017
a8ca393
Fix task 5
shabashoff Nov 16, 2017
582ff31
Add task 6
shabashoff Nov 16, 2017
104fd01
Merge branch 'master' of https://github.com/elefus/epam-leti-10-2017 …
shabashoff Nov 16, 2017
78694c0
Add task 8
shabashoff Nov 16, 2017
1a6e65e
Добавлено условие задач №16 и 17.
elefus Nov 16, 2017
316245c
Добавлен код с 13 занятия (17.11.2017).
elefus Nov 21, 2017
8515d60
Добавлен код с 14 занятия (20.11.2017).
elefus Nov 21, 2017
2379a84
Задание зачтено
elefus Nov 22, 2017
7f67e9c
Revert "Task 8 completed (Shabashov)"
elefus Nov 22, 2017
ebb7411
Откат вливания ветки Shabashov в мастер
elefus Nov 22, 2017
a215d92
Добавлен код с 15 занятия (22.11.2017).
elefus Nov 29, 2017
1fce843
Добавлен код с 16 занятия (24.11.2017).
elefus Nov 29, 2017
20fd255
Добавлен код с 17 занятия (27.11.2017).
elefus Nov 29, 2017
c92044c
Добавлено условие задач №18 и 19.
elefus Nov 29, 2017
b3f38d2
Добавлено условие задач №20-22.
elefus Dec 12, 2017
8d32e47
Добавлен код с занятий 18-23.
elefus Dec 12, 2017
b2aaf9b
Добавлен код с занятия 24.
elefus Dec 18, 2017
e943619
Добавлен код с занятия 25.
elefus Dec 18, 2017
54ba879
Добавлен код с занятий 26-28.
elefus Dec 24, 2017
71b02d8
Merge branch 'master' of https://github.com/elefus/epam-leti-10-2017 …
egakupi Dec 28, 2017
d82d1ef
Task19 completed with tests
egakupi Jan 15, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added lib/jdom-2.0.6.jar
Binary file not shown.
Binary file added lib/jsoup-1.11.2.jar
Binary file not shown.
Binary file added lib/log4j-api-2.10.0.jar
Binary file not shown.
Binary file added lib/log4j-core-2.10.0.jar
Binary file not shown.
Binary file added lib/lombok.jar
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.epam.jf.common.classwork.lesson12;

import java.util.Date;

public class AnonymousClassExample {

public static void main(String[] args) {
Date date = new Date() {

public int fieldA = 400;

@Override
public String toString() {
getDate1();
return "new version toString method";
}

private Date getDate1() {
return null;
}
}.getDate1();
System.out.println(date.getClass());

new Thread() {
@Override
public void run() {
super.run();
}
}.start();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.epam.jf.common.classwork.lesson12;

public interface BaseStream<T, S extends BaseStream<T, S>> {

S parallel();
S sequential();
S unordered();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.epam.jf.common.classwork.lesson12;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class HeapPollutionVarargs {

public static void main(String[] args) {
// List<Integer>[] arrLists = new List<Integer>[100];
// Object[] objects = arrLists;
// List<String>[] arrStrings = (List<String>[])objects;
// arrStrings[0].add("123");
List<Integer> list = new ArrayList<>();
list.add(0);
List<Integer> list2 = new ArrayList<>();

List<String> strings = convert(list, list2);

String val = strings.get(0);
System.out.println(val);
}

private static List<String> convert(List<Integer>...args) {
Object[ ] objects = args;
return (List<String>) objects[0];
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
package com.epam.jf.common.classwork.lesson12;

public class InnerExample {

private int field = 200;

class A {

// private int field = 400;

public int getField() {
return InnerExample.this.field;
}
}

class B extends A {

private String val = "123";

class C extends B implements MyInterface {

}
}

public void setField(int field) {
this.field = field;
}
}

interface MyInterface {

}

class D extends InnerExample.A {

private int fieldD = 42;

public D(InnerExample obj) {
obj.super();
}

public static void main(String[] args) {
InnerExample ref = new InnerExample();
ref.setField(300);
D d = new D(ref);
System.out.println(d.getField());

ref.setField(400);
System.out.println(d.getField());

InnerExample innerExample = new InnerExample();
InnerExample.B b = innerExample.new B();
}

private void test() {
System.out.println(this.fieldD);

class E {
private int fieldE = 100;
public int getFieldD() {
return fieldD;
}
}

E e = null;
e.fieldE = 500;
System.out.println(e.getFieldD());
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.epam.jf.common.classwork.lesson12;

public class NestedExample {

private int field = 100;

static class J extends K {

public J(NestedExample ref) {
ref.super();
}
}

class K {

}
}
16 changes: 16 additions & 0 deletions src/main/java/com/epam/jf/common/classwork/lesson12/Stream.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.epam.jf.common.classwork.lesson12;

public interface Stream<T> extends BaseStream<T, Stream<T>> {

Stream<T> sorted();
Stream<T> ordered();
}


class StreamLauncher {

public static void main(String[] args) {
Stream<Integer> stream = null;
stream.sorted().ordered().parallel().sorted().ordered().unordered();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.epam.jf.common.classwork.lesson12;

public class StringBuilderExample {

public static void main(String[] args) {
StringBuilder builder = new StringBuilder();
builder.append("123")
.append("123")
.insert(0, "12");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.epam.jf.common.classwork.lesson12;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class WTFGenerics {

public static void main(String[] args) {
List<Integer> integers = Arrays.asList(1, 2, 3);
// getFirstNumber(integers);
Number first = getFirst(integers);
Integer firstGeneric = getFirstGeneric(integers);

String str = createList();
}

private static <T extends List> T createList() {
return (T)new ArrayList<>();
}

private static Number getFirstNumber(List<Number> list) {
return list.get(0);
}

private static Number getFirst(List<? extends Number> list) {
return list.get(0);
}

private static <T extends Number> T getFirstGeneric(List<T> list) {
return list.get(0);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.epam.jf.common.classwork.lesson13;

import java.lang.annotation.Annotation;
import java.util.Arrays;

/**
* abc
* @see SingleFieldAnnotation
*/
@MyAnnotation(author = "me", version = "1.0", values = {1, 2, 3})
@SingleFieldAnnotation
public class AnnotationExample {

@SingleFieldAnnotation
private final int value = 10;

@MyAnnotation(author = "me", version = "1.0")
@SingleFieldAnnotation("123")
public static void main(String[] args) {

}

@SuppressWarnings({"unused", "abc"})
private @SingleFieldAnnotation int method() {
return 0;
}

@Override
@SingleFieldAnnotation
public String toString() {
return super.toString();
}
}

class B extends AnnotationExample {

public static void main(String[] args) {
for (Annotation annotation : AnnotationExample.class.getAnnotations()) {
System.out.println(annotation);
}

MyAnnotation annotation = AnnotationExample.class.getAnnotation(MyAnnotation.class);
System.out.println(Arrays.toString(annotation.values()));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.epam.jf.common.classwork.lesson13;


import java.util.Arrays;
import java.util.Comparator;

@SuppressWarnings("Convert2Lambda")
public class AnonymousClassExample {

public static void main(String[] args) {
Integer[] arr = {1, 2, 3, 4, 1, 2, 3};

Arrays.sort(arr, new Comparator<Integer>() {
@Override
public int compare(Integer o1, Integer o2) {
return Integer.compare(o2, o1);
}
});

System.out.println(Arrays.toString(arr));

A a = new A() {
@Override
int method() {
return 1;
}
};
System.out.println(a.method());

}
}

class A {
int method() {
return 0;
}
}



Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.epam.jf.common.classwork.lesson13;

interface Left {

default int getValue() {
return 10;
}
}

interface Right {

default int getValue() {
return -10;
}
}

class C {

}

public class DefaultMethodsExample extends C implements Left, Right {

@Override
public int getValue() {
return Left.super.getValue() + Right.super.getValue();
}

public static void main(String[] args) {
System.out.println(new DefaultMethodsExample().getValue());
}
}
Loading