Package explore.java

Source Code of explore.java.TestBed

package explore.java;

import com.google.common.base.Function;
import com.google.common.collect.ContiguousSet;
import com.google.common.collect.DiscreteDomain;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Range;
import explore.java.controlAbstraction.ControlAbstraction;
import explore.java.exceptionhandler.AnonExceptionHandler;
import explore.java.finallytest.FinallyTest;
import explore.java.generics.GenericsPlay;
import explore.java.java7.Java7;
import explore.java.overriding.Overrider;
import java.util.List;
import java.util.NavigableMap;

/**
*
* @author razvan
*/
public class TestBed {

    void play() {

        final List<String> names = Lists.newArrayList("Pratik", "Pratik2", "Ram", "Varun");
        ImmutableMap<Integer, String> myMap = Maps.uniqueIndex(names, new Function<String, Integer>() {
            @Override
            public Integer apply(String input) {
                return names.lastIndexOf(input);
            }
        });
        //System.out.println(myMap);

        final NavigableMap<Integer, String> map = Maps.asMap(
                ContiguousSet.create(Range.closedOpen(0, names.size()), DiscreteDomain.integers()),
                new Function<Integer, String>() {
                    @Override
                    public String apply(Integer input) {
                        return names.get(input);
                    }
                });

        System.out.println(map);

        //~~~~~~
        System.out.println("~~~ basics ~~~");
        Explore explore = new Explore();
        explore.bizarreInitializationsAndComparisons();
        explore.autoboxingUnboxing();
        byte b = 5;
        double d = 2.0;
        System.out.println(explore.returnType(b, d));
        System.out.println("~~~ ca ~~~");
        ControlAbstraction ca = new ControlAbstraction();
        System.out.println(ca.wordsEnding("t"));
        System.out.println(ca.wordsContaining("am"));
        System.out.println(ca.wordsEndingFunctional("t"));
        System.out.println(ca.wordsContainingFunctional("am"));
        System.out.println("~~~ eh ~~~");
        new AnonExceptionHandler().play();
        System.out.println("~~~ ft ~~~");
        new FinallyTest().play();
        System.out.println("~~~ j7 ~~~");
        new Java7();
        System.out.println("~~~ ov ~~~");
        new Overrider().play();
        System.out.println("~~~ Generics ~~~");
        new GenericsPlay().play();
    }

    public static void main(String[] args) {
        new TestBed().play();
    }

}
TOP

Related Classes of explore.java.TestBed

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.