Intermediate Java Tutorial – 18 – Implementing a Generic Method

[ad_1]
Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –


Posted

in

by

Tags:

Comments

21 responses to “Intermediate Java Tutorial – 18 – Implementing a Generic Method”

  1. Alison Xu Avatar

    please replace my uni teachers

  2. Shen-Yu Sun Avatar

    Thank you Bucky, this is so useful! I finally got an idea about what generics class is. Thanks to you! I'm not sure why my professor explain it so complicated

  3. Felix Mildon Avatar

    Thank god I'm doing my data structures and algorithms in java. Another semester with the buckmeister 🙂

  4. Volo Avatar

    my god this is SO much more easier to understand

  5. Filip Antic Avatar

    why you dont use Object class instead of T?

  6. Dexy Studio Avatar

    thanks, Great Explanation.

  7. Smael64 Avatar

    How come this code does not work with primitive arrays? ex. int[] instead of Integer[]

  8. Mohammad Shihab Avatar

    what should i do if i want to print collections

  9. Caldera11 Avatar

    oh shit wuddup this is useful

  10. Idiot Productions Avatar

    So is it good programming practice to use generic methods? Or should one use specific data types whenever possible?

  11. Tushar Mahajan Avatar

    Why would you use generics when you could just use an Object[]?

  12. Matias Vega Avatar

    Why aren't we using int and char?

  13. The Enigmatrix Avatar

    Thanks so much Bucky, these tutorials are just awesome. I've watched every one since the first beginner tutorial and I've learned so much. Generics always looked scary to me but you explain it so simply it just clicks. Huge credit to you man.

  14. Sawyer McBride Avatar

    type sysout and then control space for a SHORTCUT for System.out.println("");
    Only in elcipse

  15. Ou De Zhong Avatar

    lol its funny that u start worrying about code conventions only now 1:06 … well… better late than never ey? other than that best tutorials ever!!! thx for putting them up!!!

  16. Harith Perera Avatar

    Why do we need a wrapper class Integer and Character here?? Instead of having int and char..

  17. John Brackley Avatar

    hello my name is jeff

  18. Jeremy Chen Avatar

    import java.util.*;

    public class julian {
        public static void main(String[] args) {

            Integer[] iray = {1,2,3,4};
            Character[] cray = {'b', 'u', 'c', 'k'};

            printMe(iray);
            printMe(cray);
        }

        public static <T> void printMe(T[] x) {
            for(T b : x)
                System.out.printf("%s ", b);
            System.out.println();
        }
    }

  19. AkaLee Avatar

    its worth mentioning that generic methods can only use the parametrized type within the scope of the block

  20. Sachi Singla Avatar

    What's the difference between Integer[] and int[] array (Character[] and char[] array) ?
    I know Integer and Character are built-in classes ad int and char are datatypes but still what's the difference between using the two ?

Leave a Reply

Your email address will not be published. Required fields are marked *