interface EventListener {
void onEvent(Event event);
}
interface EventDispatcher {
void register(EventListener listener);
void dispatch(Event event);
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.hibernate.HibernateException; | |
import org.hibernate.engine.spi.SharedSessionContractImplementor; | |
import org.hibernate.usertype.UserType; | |
import java.io.Serializable; | |
import java.sql.Array; | |
import java.sql.Connection; | |
import java.sql.PreparedStatement; | |
import java.sql.ResultSet; | |
import java.sql.SQLException; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;Определить функцию, удаляющую из списка все элементы, входящие в список ровно один раз | |
; а) для элементов верхнего уровня списка | |
; b) для списка, содержащего подсписки. | |
(defun flat (Lsp &optional acc) | |
(cond ((null Lsp) acc) ; дошли до конца - возвращаем acc | |
((atom Lsp) (cons Lsp acc)) ; Lsp - атом -> acc + Lsp | |
((flat (car Lsp) (flat (cdr Lsp) acc))))) ; иначе вызываем flat где w = первый элемент Lsp, acc = (flat (cdr Lsp) acc) | |
(defun nonunique (Lsp &optional (v Lsp)) ; по умолчанию v = Lsp (исходный список) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.epam.learning; | |
import org.springframework.stereotype.Controller; | |
import org.springframework.ui.Model; | |
import org.springframework.web.bind.annotation.*; | |
@Controller | |
public class RestController { | |
@GetMapping("/write") | |
@ResponseBody |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class GroupsSearcher implements Searcher { | |
public GroupsSearcher() { | |
} | |
@Override | |
public Group[] createGroups(ReviewSector reviewSector) { | |
List<Group> groups = createListGroups(reviewSector); | |
return groups.toArray(new Group[groups.size()]); | |
} |
Benchmark Mode Cnt Score Error Units
SearcherBench.mergeSearcher thrpt 10 0,020 ? 0,001 ops/ms
SearcherBench.nonRecursiveSearcher thrpt 10 1,549 ? 0,048 ops/ms
SearcherBench.nonRecursiveSearcherOptimised thrpt 10 1,358 ? 0,043 ops/ms
SearcherBench.recursiveSearcher thrpt 10 1,820 ? 0,046 ops/ms
SearcherBench.mergeSearcher avgt 10 39,331 ? 1,608 ms/op
SearcherBench.nonRecursiveSearcher avgt 10 0,648 ? 0,018 ms/op
SearcherBench.nonRecursiveSearcherOptimised avgt 10 0,752 ? 0,033 ms/op
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DynamicArray<T>: IMyList<T>, IEnumerable<T>, IEnumerable | |
{ | |
private static readonly Func<int, int> IncFunc = x => x * 2; | |
private const int DefaultCapacity = 8; | |
private T[] _items; | |
private int _size; | |
/// <summary> | |
/// The number of times this list has been structurally modified. | |
/// </summary> | |
private int _modCount; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Data; | |
using System.Diagnostics; | |
using System.Drawing; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Windows.Forms; |
NewerOlder