All posts by Volov Alexander

Functional Interfaces Overview

Java 8 provided a lot of new and very useful features that we can use in our everyday life. In this post I decided make an overview with examples of most  commonly used built-in functional interfaces.

lambda

I’d like to start from the definition, what is the functional interface? By the definition any interface that has only one abstract method is considered to be a functional interface. Another name for such interfaces is Single Abstract Method interfaces (SAM Interfaces). For instance, Runnable is absolutely legal FI and as you can see it’s annotated now with FunctionalInterface annotation. Continue reading Functional Interfaces Overview

Intro in Binary Representations and Bit Manipulation

First of all, what is a bit (short for binary digit)? You can think of it as an atom which can be used to build information. In fact, a bit has only two unique states: zero or one. Sometimes you can find another definition like “yes/no”, “on/off” or  “true/false”. But, all this stuff boils down to the same thing.

none

To represent more meaningful information other than zero or one we need a
bunch of bits that can be grouped together. For example, eight bits are able to produce 256 (2^8) unique numbers: Continue reading Intro in Binary Representations and Bit Manipulation

Power Rule, Product Rule, Quotient Rule and Chain Rule

Recently, I had a need to use derivative. So I decided to make this short overview of the four fundamental rules to refresh and recall my knowledge in evaluating derivatives.

deriv2

The overview doesn’t contain any proves, it’s just a reference where you and I can quickly find differentiation rules that can be applied on derivatives. Moreover, I skipped some other rules such as sum or difference rule.

Continue reading Power Rule, Product Rule, Quotient Rule and Chain Rule

Trie

Trie or prefix tree is a tree-like data structure that implements dictionary abstract data type. In other words, trie allows to store key/value pairs in hierarchical structure. For example, let say we have words {a, as, air, aim, ail, car, i, milk, be, bag}. These words can be represented as follows.

trie_intro4

As you can see the root of the trie is an empty string that has five direct children. Every child represents first letter of a given word so that the words with the same prefix share the common nodes. As a result, a key can consist of one or more nodes, but values stored in one node.

Continue reading Trie

Java Concurrency Overview Part 2

In this part I’ll try to make an overview of java.util.concurrent framework that provides high-level building blocks for creating concurrent applications. These building blocks have high performance, thread-safe, widely used in Java world and moreover they have been thoroughly tested.

traffic_jam

The reason why this framework was introduced in Java 1.5 is that low-level API such as wait(), notify() and so on are too primitive and force developers to create their own custom high-level libraries.

Continue reading Java Concurrency Overview Part 2