Implement Decade Class from Ennead Class in Java using JavaTuples

Prerequisite: Decade Class, Ennead Class

Below are the methods to implement a Decade Class using Ennead Class in Java:

  1. Using direct values
    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    // Java program to illustrate
    // implementing Decade Class 
    // from Ennead Class 
    // using direct values
      
    import java.util.*;
    import org.javatuples.*;
      
    class GfG {
      
        public static void main(String[] args)
        {
            // Create Ennead
            Ennead<String, String, String, String, String, String, String, String, String>
                ennead = new Ennead<String, String, String, String, String, String, String, String, String>(
                    "Ennead", "Octet", "Septet", "Sextet", "Quintet", "Quartet", "Triplet", "Pair", "Unit");
      
            // Print the Ennead
            System.out.println("Ennead: " + ennead);
      
            // Create Decade from Ennead
            Decade<String, String, String, String, String, String, String, String, String, String>
                decade = new Decade<String, String, String, String, String, String, String, String, String, String>(
                    "Decade",
                    ennead.getValue0(),
                    ennead.getValue1(),
                    ennead.getValue2(),
                    ennead.getValue3(),
                    ennead.getValue4(),
                    ennead.getValue5(),
                    ennead.getValue6(),
                    ennead.getValue7(),
                    ennead.getValue8());
      
            // Print the Decade
            System.out.println("Decade: " + decade);
        }
    }

    chevron_right

    
    

    Output:

    Ennead: [Ennead, Octet, Septet, Sextet, Quintet, Quartet, Triplet, Pair, Unit]
    Decade: [Decade, Ennead, Octet, Septet, Sextet, Quintet, Quartet, Triplet, Pair, Unit]
    
  2. Using Ennead.add() method
    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    // Java program to illustrate
    // implementing Decade Class 
    // from Ennead Class 
    // using add() values
      
    import java.util.*;
    import org.javatuples.*;
      
    class GfG {
        public static void main(String[] args)
        {
            // Create Ennead
            Ennead<String, String, String, String, String, String, String, String, String>
                ennead = new Ennead<String, String, String, String, String, String, String, String, String>(
                    "Ennead", "Octet", "Septet", "Sextet", "Quintet", "Quartet", "Triplet", "Pair", "Unit");
      
            // Print the Ennead
            System.out.println("Ennead: " + ennead);
      
            // Create Decade from Ennead
            Decade<String, String, String, String, String, String, String, String, String, String>
                decade = ennead.add("Decade");
      
            // Print the Decade
            System.out.println("Decade: " + decade);
        }
    }

    chevron_right

    
    

    Output:

    Ennead: [Ennead, Octet, Septet, Sextet, Quintet, Quartet, Triplet, Pair, Unit]
    Decade: [Ennead, Octet, Septet, Sextet, Quintet, Quartet, Triplet, Pair, Unit, Decade]
    
  3. Using Ennead.addAtX() method

    Program 1: Adding at Position 0 using addAt0()

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    // Java program to illustrate
    // implementing Decade Class 
    // from Ennead Class 
    // using addAt0() values
      
    import java.util.*;
    import org.javatuples.*
      
        class GfG {
        public static void main(String[] args)
        {
           // Create Ennead
            Ennead<String, String, String, String, String, String, String, String, String>
                ennead = new Ennead<String, String, String, String, String, String, String, String, String>(
                    "Ennead", "Octet", "Septet", "Sextet", "Quintet", "Quartet", "Triplet", "Pair", "Unit");
      
            // Print the Ennead
            System.out.println("Ennead: " + ennead);
      
            // Create Decade from Ennead
            Decade<String, String, String, String, String, String, String, String, String, String>
                decade = ennead.addAt0("Decade");
      
            // Print the Decade
            System.out.println("Decade: " + decade);
        }
    }

    chevron_right

    
    

    Output:

    Ennead: [Ennead, Octet, Septet, Sextet, Quintet, Quartet, Triplet, Pair, Unit]
    Decade: [Decade, Ennead, Octet, Septet, Sextet, Quintet, Quartet, Triplet, Pair, Unit]
    

    Program 2: Adding at Position 1 using addAt1()

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    // Java program to illustrate
    // implementing Decade Class 
    // from Ennead Class 
    // using add()At1
      
    import java.util.*;
    import org.javatuples.*;
      
    class GfG {
        public static void main(String[] args)
        {
            // Create Ennead
            Ennead<String, String, String, String, String, String, String, String, String>
                ennead = new Ennead<String, String, String, String, String, String, String, String, String>(
                    "Ennead", "Octet", "Septet", "Sextet", "Quintet", "Quartet", "Triplet", "Pair", "Unit");
      
            // Print the Ennead
            System.out.println("Ennead: " + ennead);
      
            // Create Decade from Ennead
            Decade<String, String, String, String, String, String, String, String, String, String>
                decade = ennead.addAt1("Decade");
      
            // Print the Decade
            System.out.println("Decade: " + decade);
        }
    }

    chevron_right

    
    

    Output:

    Ennead: [Ennead, Octet, Septet, Sextet, Quintet, Quartet, Triplet, Pair, Unit]
    Decade: [Ennead, Decade, Octet, Septet, Sextet, Quintet, Quartet, Triplet, Pair, Unit]
    

    Program 3: Adding at Position 2 using addAt2()

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    // Below is a Java program to demonstrate
    // use of addAt2() method with
    // direct value
      
    import java.util.*;
    import org.javatuples.*
      
        class GfG {
        public static void main(String[] args)
        {
            // Create Ennead
            Ennead<String, String, String, String, String, String, String, String, String>
                ennead = new Ennead<String, String, String, String, String, String, String, String, String>(
                    "Ennead", "Octet", "Septet", "Sextet", "Quintet", "Quartet", "Triplet", "Pair", "Unit");
      
            // Print the Ennead
            System.out.println("Ennead: " + ennead);
      
            // Create Decade from Ennead
            Decade<String, String, String, String, String, String, String, String, String, String>
                decade = ennead.addAt2("Decade");
      
            // Print the Decade
            System.out.println("Decade: " + decade);
        }
    }

    chevron_right

    
    

    Output:

    Ennead: [Ennead, Octet, Septet, Sextet, Quintet, Quartet, Triplet, Pair, Unit]
    Decade: [Ennead, Octet, Decade, Septet, Sextet, Quintet, Quartet, Triplet, Pair, Unit]
    

    Program 4: Adding at Position 3 using addAt3()

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    // Below is a Java program to demonstrate
    // use of addAt3() method with
    // direct value
      
    import java.util.*;
    import org.javatuples.*
      
        class GfG {
        public static void main(String[] args)
        {
            // Create Ennead
            Ennead<String, String, String, String, String, String, String, String, String>
                ennead = new Ennead<String, String, String, String, String, String, String, String, String>(
                    "Ennead", "Octet", "Septet", "Sextet", "Quintet", "Quartet", "Triplet", "Pair", "Unit");
      
            // Print the Ennead
            System.out.println("Ennead: " + ennead);
      
            // Create Decade from Ennead
            Decade<String, String, String, String, String, String, String, String, String, String>
                decade = ennead.addAt3("Decade");
      
            // Print the Decade
            System.out.println("Decade: " + decade);
        }
    }

    chevron_right

    
    

    Output:

    Ennead: [Ennead, Octet, Septet, Sextet, Quintet, Quartet, Triplet, Pair, Unit]
    Decade: [Ennead, Octet, Septet, Decade, Sextet, Quintet, Quartet, Triplet, Pair, Unit]
    

    Program 5: Adding at Position 4 using addAt4()

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    // Below is a Java program to demonstrate
    // use of addAt4() method with
    // direct value
      
    import java.util.*;
    import org.javatuples.*
      
       class GfG {
        public static void main(String[] args)
        {
            // Create Ennead
            Ennead<String, String, String, String, String, String, String, String, String>
                ennead = new Ennead<String, String, String, String, String, String, String, String, String>(
                    "Ennead", "Octet", "Septet", "Sextet", "Quintet", "Quartet", "Triplet", "Pair", "Unit");
      
            // Print the Ennead
            System.out.println("Ennead: " + ennead);
      
            // Create Decade from Ennead
            Decade<String, String, String, String, String, String, String, String, String, String>
                decade = ennead.addAt4("Decade");
      
            // Print the Decade
            System.out.println("Decade: " + decade);
        }
    }

    chevron_right

    
    

    Output:

    Ennead: [Ennead, Octet, Septet, Sextet, Quintet, Quartet, Triplet, Pair, Unit]
    Decade: [Ennead, Octet, Septet, Sextet, Decade, Quintet, Quartet, Triplet, Pair, Unit]
    

    Program 6: Adding at Position 5 using addAt5()

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    // Below is a Java program to demonstrate
    // use of addAt5() method with
    // direct value
      
    import java.util.*;
    import org.javatuples.*
      
        class GfG {
        public static void main(String[] args)
        {
            // Create Ennead
            Ennead<String, String, String, String, String, String, String, String, String>
                ennead = new Ennead<String, String, String, String, String, String, String, String, String>(
                    "Ennead", "Octet", "Septet", "Sextet", "Quintet", "Quartet", "Triplet", "Pair", "Unit");
      
            // Print the Ennead
            System.out.println("Ennead: " + ennead);
      
            // Create Decade from Ennead
            Decade<String, String, String, String, String, String, String, String, String, String>
                decade = ennead.addAt5("Decade");
      
            // Print the Decade
            System.out.println("Decade: " + decade);
        }
    }

    chevron_right

    
    

    Output:

    Ennead: [Ennead, Octet, Septet, Sextet, Quintet, Quartet, Triplet, Pair, Unit]
    Decade: [Ennead, Octet, Septet, Sextet, Quintet, Decade, Quartet, Triplet, Pair, Unit]
    

    Program 7: Adding at Position 6 using addAt6()

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    // Below is a Java program to demonstrate
    // use of addAt6() method with
    // direct value
      
    import java.util.*;
    import org.javatuples.*
      
       class GfG {
        public static void main(String[] args)
        {
            // Create Ennead
            Ennead<String, String, String, String, String, String, String, String, String>
                ennead = new Ennead<String, String, String, String, String, String, String, String, String>(
                    "Ennead", "Octet", "Septet", "Sextet", "Quintet", "Quartet", "Triplet", "Pair", "Unit");
      
            // Print the Ennead
            System.out.println("Ennead: " + ennead);
      
            // Create Decade from Ennead
            Decade<String, String, String, String, String, String, String, String, String, String>
                decade = ennead.addAt6("Decade");
      
            // Print the Decade
            System.out.println("Decade: " + decade);
        }
    }

    chevron_right

    
    

    Output:

    Ennead: [Ennead, Octet, Septet, Sextet, Quintet, Quartet, Triplet, Pair, Unit]
    Decade: [Ennead, Octet, Septet, Sextet, Quintet, Quartet, Decade, Triplet, Pair, Unit]
    

    Program 8: Adding at Position 7 using addAt7()

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    // Below is a Java program to demonstrate
    // use of addAt7() method with
    // direct value
      
    import java.util.*;
    import org.javatuples.*
      
       class GfG {
        public static void main(String[] args)
        {
            // Create Ennead
            Ennead<String, String, String, String, String, String, String, String, String>
                ennead = new Ennead<String, String, String, String, String, String, String, String, String>(
                    "Ennead", "Octet", "Septet", "Sextet", "Quintet", "Quartet", "Triplet", "Pair", "Unit");
      
            // Print the Ennead
            System.out.println("Ennead: " + ennead);
      
            // Create Decade from Ennead
            Decade<String, String, String, String, String, String, String, String, String, String>
                decade = ennead.addAt7("Decade");
      
            // Print the Decade
            System.out.println("Decade: " + decade);
        }
    }

    chevron_right

    
    

    Output:

    Ennead: [Ennead, Octet, Septet, Sextet, Quintet, Quartet, Triplet, Pair, Unit]
    Decade: [Ennead, Octet, Septet, Sextet, Quintet, Quartet, Triplet, Decade, Pair, Unit]
    

    Program 9: Adding at Position 8 using addAt8()

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    // Below is a Java program to demonstrate
    // use of addAt8() method with
    // direct value
      
    import java.util.*;
    import org.javatuples.*
      
       class GfG {
        public static void main(String[] args)
        {
            // Create Ennead
            Ennead<String, String, String, String, String, String, String, String, String>
                ennead = new Ennead<String, String, String, String, String, String, String, String, String>(
                    "Ennead", "Octet", "Septet", "Sextet", "Quintet", "Quartet", "Triplet", "Pair", "Unit");
      
            // Print the Ennead
            System.out.println("Ennead: " + ennead);
      
            // Create Decade from Ennead
            Decade<String, String, String, String, String, String, String, String, String, String>
                decade = ennead.addAt8("Decade");
      
            // Print the Decade
            System.out.println("Decade: " + decade);
        }
    }

    chevron_right

    
    

    Output:

    Ennead: [Ennead, Octet, Septet, Sextet, Quintet, Quartet, Triplet, Pair, Unit]
    Decade: [Ennead, Octet, Septet, Sextet, Quintet, Quartet, Triplet, Pair, Decade, Unit]
    

    Program 10: Adding at Position 9 using addAt9()

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    // Below is a Java program to demonstrate
    // use of addAt9() method with
    // direct value
      
    import java.util.*;
    import org.javatuples.*
      
       class GfG {
        public static void main(String[] args)
        {
            // Create Ennead
            Ennead<String, String, String, String, String, String, String, String, String>
                ennead = new Ennead<String, String, String, String, String, String, String, String, String>(
                    "Ennead", "Octet", "Septet", "Sextet", "Quintet", "Quartet", "Triplet", "Pair", "Unit");
      
            // Print the Ennead
            System.out.println("Ennead: " + ennead);
      
            // Create Decade from Ennead
            Decade<String, String, String, String, String, String, String, String, String, String>
                decade = ennead.addAt9("Decade");
      
            // Print the Decade
            System.out.println("Decade: " + decade);
        }
    }

    chevron_right

    
    

    Output:

    Ennead: [Ennead, Octet, Septet, Sextet, Quintet, Quartet, Triplet, Pair, Unit]
    Decade: [Ennead, Octet, Septet, Sextet, Quintet, Quartet, Triplet, Pair, Unit, Decade]
    


    My Personal Notes arrow_drop_up

    Check out this Author's contributed articles.

    If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

    Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




    Article Tags :
    Practice Tags :


    Be the First to upvote.


    Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.