<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Illya Kysil</title>
    <description>The latest articles on DEV Community by Illya Kysil (@ikysil).</description>
    <link>https://dev.to/ikysil</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F77732%2F6c17d315-dac9-4629-93ed-a316e5ccdf39.png</url>
      <title>DEV Community: Illya Kysil</title>
      <link>https://dev.to/ikysil</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ikysil"/>
    <language>en</language>
    <item>
      <title>Type Pattern Matching - CORBA Style</title>
      <dc:creator>Illya Kysil</dc:creator>
      <pubDate>Fri, 09 Oct 2020 00:00:00 +0000</pubDate>
      <link>https://dev.to/ikysil/type-pattern-matching-corba-style-2b73</link>
      <guid>https://dev.to/ikysil/type-pattern-matching-corba-style-2b73</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package io.github.ikysil.javaplayground.narrow;

import java.util.List;
import java.util.Optional;

public class TypeNarrowDemo {

    static final class Types {

        private Types() throws IllegalAccessException {
            throw new IllegalAccessException();
        }

        static &amp;lt;T&amp;gt; T narrowToNull(final Object obj, final Class&amp;lt;T&amp;gt; expectedType) {
            if (expectedType.isInstance(obj)) {
                return expectedType.cast(obj);
            }
            return null;
        }

        static &amp;lt;T&amp;gt; Optional&amp;lt;T&amp;gt; narrow(final Object obj, final Class&amp;lt;T&amp;gt; expectedType) {
            return Optional.ofNullable(obj)
                .map(o -&amp;gt; narrowToNull(o, expectedType));
        }

    }

    public static void main(String[] args) {
        System.out.println("TypeNarrowDemo Demo");
        if (Types.narrowToNull("test", Object.class) != null) {
            System.out.println("SUCCESS: String is Object");
        }
        Types.narrow("test", Object.class)
            .ifPresent(o -&amp;gt; System.out.println("SUCCESS: String is Object: " + o));
        if (Types.narrowToNull("test", List.class) == null) {
            System.out.println("SUCCESS: String is NOT List");
        }
        Types.narrow("test", List.class)
            .ifPresentOrElse(
                o -&amp;gt; System.out.println("ERROR: String is NOT List: " + o),
                () -&amp;gt; System.out.println("SUCCESS: String is NOT List")
            );
    }

}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;GitHub Repository: &lt;a href="https://github.com/ikysil/java-playground"&gt;java-playground&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Type Switch with Functional Java 8</title>
      <dc:creator>Illya Kysil</dc:creator>
      <pubDate>Wed, 06 May 2020 20:17:40 +0000</pubDate>
      <link>https://dev.to/ikysil/type-switch-with-functional-java-8-48im</link>
      <guid>https://dev.to/ikysil/type-switch-with-functional-java-8-48im</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kn"&gt;package&lt;/span&gt; &lt;span class="nn"&gt;io.github.ikysil.javaplayground.typeswitch&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;javax.swing.*&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;java.util.function.Consumer&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;java.util.function.Supplier&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;TypeSwitchDemo&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

    &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;TypeSwitch&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;T&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

        &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="no"&gt;T&lt;/span&gt; &lt;span class="n"&gt;instance&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

        &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="nf"&gt;TypeSwitch&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="no"&gt;T&lt;/span&gt; &lt;span class="n"&gt;instance&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;instance&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;instance&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;

        &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;T&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;TypeSwitch&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;T&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;of&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="no"&gt;T&lt;/span&gt; &lt;span class="n"&gt;instance&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;TypeSwitch&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;gt;(&lt;/span&gt;&lt;span class="n"&gt;instance&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;

        &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;T&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;TypeSwitch&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;T&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;of&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="nc"&gt;Supplier&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;T&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;instanceSupplier&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;TypeSwitch&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;gt;(&lt;/span&gt;&lt;span class="n"&gt;instanceSupplier&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="o"&gt;());&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;

        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;I&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;TypeSwitch&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;T&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;instanceOf&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="nc"&gt;Class&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;I&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;type&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="nc"&gt;Consumer&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;I&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;consumer&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;type&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;isInstance&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;instance&lt;/span&gt;&lt;span class="o"&gt;))&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
                &lt;span class="n"&gt;consumer&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;accept&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;type&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;cast&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;instance&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt;
            &lt;span class="o"&gt;}&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;

        &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;noneMatches&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="nc"&gt;Consumer&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Object&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;consumer&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;consumer&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;accept&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;instance&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"TypeSwitch Demo"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="nc"&gt;TypeSwitch&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;of&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;JLabel&lt;/span&gt;&lt;span class="o"&gt;())&lt;/span&gt;
            &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;instanceOf&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;JComponent&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"matched JComponent"&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt;
        &lt;span class="nc"&gt;TypeSwitch&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;of&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Object&lt;/span&gt;&lt;span class="o"&gt;())&lt;/span&gt;
            &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;instanceOf&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;JComponent&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"matched JComponent"&lt;/span&gt;&lt;span class="o"&gt;))&lt;/span&gt;
            &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;noneMatches&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;o&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;printf&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"none matched: %s of %s%n"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getClass&lt;/span&gt;&lt;span class="o"&gt;()));&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;GitHub Repository: &lt;a href="https://github.com/ikysil/java-playground"&gt;java-playground&lt;/a&gt;&lt;/p&gt;

</description>
      <category>java8</category>
    </item>
    <item>
      <title>Implementing Fluent Builder with Functional Java 8</title>
      <dc:creator>Illya Kysil</dc:creator>
      <pubDate>Wed, 07 Nov 2018 00:00:00 +0000</pubDate>
      <link>https://dev.to/ikysil/implementing-fluent-builder-with-functional-java-8-d9k</link>
      <guid>https://dev.to/ikysil/implementing-fluent-builder-with-functional-java-8-d9k</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package playground;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
import javax.swing.*;

import static playground.JavaPlayground.Builder.of;

public class FunctionalBuilderDemo {

    static class Builder&amp;lt;T&amp;gt; {

        private final T instance;

        private Builder(final T instance) {
            Objects.requireNonNull(instance, "instance is required");
            this.instance = instance;
        }

        static &amp;lt;T&amp;gt; Builder&amp;lt;T&amp;gt; of(final T instance) {
            return new Builder&amp;lt;&amp;gt;(instance);
        }

        static &amp;lt;T&amp;gt; Builder&amp;lt;T&amp;gt; of(final Supplier&amp;lt;T&amp;gt; supplier) {
            return new Builder&amp;lt;&amp;gt;(supplier.get());
        }

        public Builder&amp;lt;T&amp;gt; with(final Consumer&amp;lt;T&amp;gt; c) {
            c.accept(instance);
            return this;
        }

        public &amp;lt;V&amp;gt; Builder&amp;lt;T&amp;gt; with(final BiConsumer&amp;lt;T, ? super V&amp;gt; c, final V value) {
            c.accept(instance, value);
            return this;
        }

        public &amp;lt;V&amp;gt; Builder&amp;lt;T&amp;gt; add(final Supplier&amp;lt;Collection&amp;lt;? super V&amp;gt;&amp;gt; c, final V value) {
            c.get().add(value);
            return this;
        }

        public &amp;lt;V&amp;gt; Builder&amp;lt;T&amp;gt; add(final Function&amp;lt;T, Collection&amp;lt;? super V&amp;gt;&amp;gt; c, final V v) {
            c.apply(instance).add(v);
            return this;
        }

        public &amp;lt;V&amp;gt; Builder&amp;lt;T&amp;gt; add(final Function&amp;lt;T, Collection&amp;lt;? super V&amp;gt;&amp;gt; c, final V... v) {
            c.apply(instance).addAll(Arrays.asList(v));
            return this;
        }

        public &amp;lt;V&amp;gt; CollectionBuilder&amp;lt;T, V&amp;gt; collectInto(final Function&amp;lt;T, Collection&amp;lt;? super V&amp;gt;&amp;gt; c) {
            return new CollectionBuilder&amp;lt;&amp;gt;(this, c);
        }

        public &amp;lt;V&amp;gt; CollectionBuilder2&amp;lt;T, V&amp;gt; collect(final Collection&amp;lt;V&amp;gt; c) {
            return new CollectionBuilder2&amp;lt;&amp;gt;(this, c);
        }

        public &amp;lt;V&amp;gt; CollectionBuilder2&amp;lt;T, V&amp;gt; collect(final Supplier&amp;lt;Collection&amp;lt;V&amp;gt;&amp;gt; c) {
            return collect(c.get());
        }

        public &amp;lt;V&amp;gt; CollectionBuilder2&amp;lt;T, V&amp;gt; collect() {
            return collect(new ArrayList&amp;lt;&amp;gt;());
        }

        public T instance() {
            return instance;
        }

    }

    static class CollectionBuilder&amp;lt;T, V&amp;gt; {

        private final Builder&amp;lt;T&amp;gt; builder;

        private final Function&amp;lt;T, Collection&amp;lt;? super V&amp;gt;&amp;gt; c;

        public CollectionBuilder(final Builder&amp;lt;T&amp;gt; builder, final Function&amp;lt;T, Collection&amp;lt;? super V&amp;gt;&amp;gt; c) {
            this.builder = builder;
            this.c = c;
        }

        public Builder&amp;lt;T&amp;gt; collect() {
            return builder;
        }

        public CollectionBuilder&amp;lt;T, V&amp;gt; add(final V value) {
            c.apply(builder.instance()).add(value);
            return this;
        }

    }

    static class CollectionBuilder2&amp;lt;T, V&amp;gt; {

        private final Builder&amp;lt;T&amp;gt; builder;

        private final Collection&amp;lt;V&amp;gt; c;

        public CollectionBuilder2(final Builder&amp;lt;T&amp;gt; builder, final Collection&amp;lt;V&amp;gt; c) {
            this.builder = builder;
            this.c = c;
        }

        public Builder&amp;lt;T&amp;gt; into(final Function&amp;lt;T, Collection&amp;lt;? super V&amp;gt;&amp;gt; finalCollector) {
            finalCollector.apply(builder.instance()).addAll(c);
            return builder;
        }

        public CollectionBuilder2&amp;lt;T, V&amp;gt; add(final V value) {
            c.add(value);
            return this;
        }

    }

    public static class Victim {

        private final Collection&amp;lt;String&amp;gt; strings = new ArrayList&amp;lt;&amp;gt;();

        private final Collection&amp;lt;Number&amp;gt; numbers = new ArrayList&amp;lt;&amp;gt;();

        Collection&amp;lt;String&amp;gt; getStrings() {
            return strings;
        }

        Collection&amp;lt;Number&amp;gt; getNumbers() {
            return numbers;
        }

        @Override
        public String toString() {
            return "Victim{" +
                "strings=" + strings +
                ", numbers=" + numbers +
                '}';
        }

    }

    public static void main(String[] args) {
        System.out.println("Functional Builder Demo");
        final JLabel jLabelInstance = of(new JLabel())
            .with(o -&amp;gt; o.setText("test"))
            .with(JLabel::setText, "test")
            .with(JLabel::setText, null)
            .with(JLabel::setDisabledIcon, of(new ImageIcon())
                .with(ImageIcon::setDescription, "icon description")
                .instance()
            )
            .instance();
        System.out.println(jLabelInstance);
        final ArrayList&amp;lt;JLabel&amp;gt; arrayListInstance = of(ArrayList&amp;lt;JLabel&amp;gt;::new)
            .with(List::add, new JLabel())
            .with(List::add, jLabelInstance)
            .instance();
        System.out.println(arrayListInstance);
        final Object instance = of(Victim::new)
            .add(Victim::getStrings, "asd")
            .add(Victim::getStrings, "asd", "def")
            .collectInto(Victim::getStrings)
            .add("qwe")
            .collect()
            .collect(ArrayList&amp;lt;String&amp;gt;::new)
            .add("poi")
            .into(Victim::getStrings)
            .&amp;lt;Integer&amp;gt;collect()
            .add(123)
            .into(Victim::getNumbers)
            .instance();
        System.out.println(instance);
    }

}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Switching JVM on Ubuntu with Bash</title>
      <dc:creator>Illya Kysil</dc:creator>
      <pubDate>Sat, 03 Nov 2018 00:00:00 +0000</pubDate>
      <link>https://dev.to/ikysil/switching-jvm-on-ubuntu-with-bash-463h</link>
      <guid>https://dev.to/ikysil/switching-jvm-on-ubuntu-with-bash-463h</guid>
      <description>&lt;p&gt;Just add following to your &lt;code&gt;.bash_aliases&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;alias resetjdkpath='
    PATH=`echo $PATH | sed -Ee 's/[/]usr[/]lib[/]jvm[^:]+//g' | sed -Ee 's/:+/:/g'`
'

alias orjdk7='
    resetjdkpath
    JAVA_HOME=/usr/lib/jvm/java-7-oracle
    J2SDKDIR=${JAVA_HOME}
    J2REDIR=${JAVA_HOME}/jre
    PATH=${JAVA_HOME}/bin:${JAVA_HOME}/db/bin:${JAVA_HOME}/jre/bin:$PATH
    DERBY_HOME=${JAVA_HOME}/db
    java -version
'

alias orjdk8='
    resetjdkpath
    JAVA_HOME=/usr/lib/jvm/java-8-oracle
    J2SDKDIR=${JAVA_HOME}
    J2REDIR=${JAVA_HOME}/jre
    PATH=${JAVA_HOME}/bin:${JAVA_HOME}/db/bin:${JAVA_HOME}/jre/bin:$PATH
    DERBY_HOME=${JAVA_HOME}/db
    java -version
'

alias orjdk9='
    resetjdkpath
    JAVA_HOME=/usr/lib/jvm/java-9-oracle
    J2SDKDIR=${JAVA_HOME}
    J2REDIR=${JAVA_HOME}/jre
    PATH=${JAVA_HOME}/bin:${JAVA_HOME}/db/bin:${JAVA_HOME}/jre/bin:$PATH
    DERBY_HOME=${JAVA_HOME}/db
    java -version
'

alias opjdk8='
    resetjdkpath
    JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
    J2SDKDIR=${JAVA_HOME}
    J2REDIR=${JAVA_HOME}/jre
    PATH=${JAVA_HOME}/bin:${JAVA_HOME}/db/bin:${JAVA_HOME}/jre/bin:$PATH
    DERBY_HOME=${JAVA_HOME}/db
    java -version
'

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
  </channel>
</rss>
