- miniJUG – Новости Java (minijug.ru)
- microJUG – Мысли о Java
- Javaswag – Еженедельная рассылка вручную отобранных статей по Java и JVM (javaswag.ru)
- JavaRush – Официальный канал JavaRush в Telegram (javarush.ru)
- javawatch – Канал Олега Чирухина (twitter.com/olegchir)
- JUGNsk News – Канал новосибирского Java-сообщества JUGNsk (youtube.com/jugnsk)
- Java: fill the gaps – Экспертные статьи по Java и её экосистеме
- Java Interview Review – Популярные вопросы и ответы с собеседований на Java-разработчика (itsobes.ru)
- letsCode – Интересное и полезное из мира разработки ([YouTube](https://www.youtube.com/ch
This file contains 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.openjdk.jmh.annotations.Benchmark; | |
import org.openjdk.jmh.annotations.BenchmarkMode; | |
import org.openjdk.jmh.annotations.Mode; | |
import org.openjdk.jmh.annotations.OutputTimeUnit; | |
import org.openjdk.jmh.annotations.Param; | |
import org.openjdk.jmh.annotations.Scope; | |
import org.openjdk.jmh.annotations.Setup; | |
import org.openjdk.jmh.annotations.State; | |
import java.util.ArrayList; |
This file contains 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
// Тайпкласс Animal (для полноты картины добавил метод hello, иначе был бы совсем тривиальный пример) | |
// Animal полностью абстрагирован от низлежашего типа A | |
trait Animal[A] { | |
def word: String | |
def talk() { println(word) } | |
def hello(a: A): String | |
} | |
// Обертка над тайпклассом Animal, чтобы можно было писать cat.hello, а не animal.hello(cat) | |
// AnimalOps полностью дублирует методы, определённые в Animal, но также может содержать еще и дополнительные методы. |
This file contains 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 com.google.common.math.Stats; | |
import org.openjdk.jmh.annotations.Benchmark; | |
import org.openjdk.jmh.annotations.BenchmarkMode; | |
import org.openjdk.jmh.annotations.Mode; | |
import org.openjdk.jmh.annotations.OutputTimeUnit; | |
import org.openjdk.jmh.annotations.Param; | |
import org.openjdk.jmh.annotations.Scope; | |
import org.openjdk.jmh.annotations.Setup; | |
import org.openjdk.jmh.annotations.State; |
This file contains 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.openjdk.jmh.annotations.*; | |
import java.util.Arrays; | |
import java.util.Random; | |
import java.util.concurrent.TimeUnit; | |
@BenchmarkMode(Mode.AverageTime) | |
@OutputTimeUnit(TimeUnit.MICROSECONDS) | |
@State(Scope.Thread) | |
public class Sort { |
This file contains 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 java.lang.ref.WeakReference; | |
public final class Main { | |
public static void main(String... args) throws Throwable { | |
Integer i = new Integer(1); | |
WeakReference<Integer> ref = new WeakReference<>(i); | |
System.gc(); | |
System.out.println(ref.get()); | |
i.signum(0); |
This file contains 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 final class Main { | |
public static void main(String... args) throws Throwable { | |
Integer i = new Integer(1); | |
WeakReference<Integer> ref = new WeakReference<>(i); | |
System.gc(); | |
System.out.println(ref.get()); | |
myStupidReachabilityFence(i); | |
} |
This file contains 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 final class ArrayIterator<A> implements Iterator<A> { | |
private int i; | |
private final A[] array; | |
ArrayIterator(final A[] array) { | |
this.array = array; | |
} | |
@Override | |
public boolean hasNext() { |
This file contains 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
-- Файл ElmComponent.elm | |
module ElmComponent exposing (..) | |
import Html exposing (..) | |
import Html.Events exposing (onClick) | |
-- Простой компонент (кнопка со счётчиком) | |
type alias Model = { text : String , counter : Int } | |
type Msg = Inc |
This file contains 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.openjdk.jmh.annotations.*; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.concurrent.TimeUnit; | |
@BenchmarkMode(Mode.AverageTime) | |
@OutputTimeUnit(TimeUnit.MICROSECONDS) | |
@State(Scope.Thread) | |
public class ArrayListCreate { |
NewerOlder