Общие Flashcards

1
Q

Шаблоны проектирования

A
  • порождающие (синглтон, билдер, фабрика)
  • структурные (прокси, бридж, адаптер, декоратор, фасад)
  • поведенческие (стратегия, команда, итератор)
  • паттерны декомпозиции (DDD, по бизнес возможностям)
  • паттерны перехода на микросервисы (душитель, параллельный запуск)
  • распределенные транзакции (сага, 2pc)
  • коммуникация и устойчивость (API gateway, Discovery, circuit braker, retry)
  • развертывание (blue green deployment)
  • sidecar container
  • external configuration
  • backend for frontend
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

распределенные транзакции

A

сага, 2pc
оркестратор, хореография

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

JMM

A

Стек, Хип

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Методы Object

A

getClass():
hashCode():
equals(Object obj):
clone()
toString()
notify()
notifyAll()
wait()
finalize()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

принципы ООП

A

инкапсуляция наследование полиморфизм

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

SOLID

A

Single Responsibility
Open/Closed
Liskov Substitution
Interface Segregation
Dependency Inversion

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

размеры примитивных типов

A

byte: 1 , 27 = 128
short: 2, 2
15 = 32768
int: 4, 231
long: 8, 2
63
float: 4,
double: 8
char: 2, 2**16

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Exceptions

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Классы многопоточности

A

Класс Thread - предоставляет самый базовый способ создания и управления потоками в Java.

Интерфейс Runnable - позволяет определить задачу, которую может выполнить поток.

Класс Executor - предоставляет удобный способ управления группой потоков

Классы Lock и Condition из пакета java.util.concurrent.locks - предоставляют механизмы блокировки и синхронизации доступа к общим ресурсам.

Классы Semaphore и CyclicBarrier из пакета java.util.concurrent - предоставляют дополнительные средства для управления поведением параллельного кода.

Классы AtomicBoolean, AtomicInteger и AtomicReference из пакета java.util.concurrent.atomic - предоставляют безопасные атомарные операции над примитивными типами данных и объектами.

Классы CountDownLatch и Exchanger из пакета java.util.concurrent - предоставляют дополнительные возможности для синхронизации потоков.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Run Time Data Areas

A

Heap, Method Area, JVM Stack, Native Method Stack

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

GC

A

default G1 since java9, responsiveness Shenandoah, big heap ZGC
G1: mark and sweep concurrently, compact not
ZGC: compact concurrently
Shenandoah: copy object object first and change reference than delete
old - serial, parallel

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Stream average

A

List<Integer> integerList = List.of(1, 2, 3, 4, 5);
double result = integerList.stream()
первый вариант
.mapToInt(Integer::intValue)
.average()
.orElse(0.0);
второй вариант
.reduce(0, Integer::sum) / (double) integerList.size();</Integer>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Stream 1-10

A

IntStream.iterate(0, i -> i + 1)
.limit(10)
IntStream.rangeClosed(1, 10)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Stream lower case

A

List<String> list = Stream.of(strings)
.map(String::toUpperCase)
.toList(); or .collect(Collectors.toList());</String>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Stream combine string

A

List<String> letters = Arrays.asList("a", "b", "c", "d", "e");
String result = letters.stream().reduce("", String::concat);</String>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Stream even

A

List<Integer> evenNumbers = IntStream.rangeClosed(1, 10)
.filter(i -> i % 2 == 0)
.boxed()
.toList();</Integer>

IntStream.iterate(0, i -> i + 2)
.limit(10)
.forEach(System.out::println);

17
Q

new in Java

A

18 - Simple Web Server
17 - sealed classes
16 - record type, Pattern Matching forinstanceof, Stream.toList
15 - text blocks, String.formatted() stripIndent(), Shenandoah GC, Z GC
14 - Switch expressions, Helpful NullPointerExceptions
12 - String ident() transform()
11 - new Http client, tls 1.3
10 - var type
9 - reactive streams, String chars (int stream), modules, List.of, G1GC default

18
Q

classloaders

A

bootstrap
extension
application

19
Q

Servlet

A

init
service (doGet, doPost)
destroy

20
Q

rest

A

representational state transfer
stateless
resource

21
Q

network

22
Q

transient

A

поле не участвует в сериализации

23
Q

функциональный интерфейс

A

Any interface with a SAM(Single Abstract Method) is a functional interface
- Primitive Function Specializations
- Two-Arity Function Specializations
- Supplier does not take any arguments
- Consumer accepts a generified argument and returns nothing
- Predicates receives a value and returns a boolean value, encapsulates the filtering logic
- Operators eceive and return the same value type
– UnaryOperator interface receives a single argument
– BinaryOperator = reduce
- Legacy as Runnable and Callable

24
Q

computeIfAbsent

A

The computeIfAbsent method takes two parameters. The first parameter is the key, and the second parameter is the mappingFunction

25
reduce binary function contract
The passed function must be associative, which means that the order of value aggregation does not matter - it allows parallelize the reduction process.