java generics integer value argument

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Tassos Souris
    New Member
    • Aug 2008
    • 152

    java generics integer value argument

    Is there an equivalent technique for java for C++ ability to pass integer values to template arguments (e.g some<6>) ???

    thanks!
  • Nepomuk
    Recognized Expert Specialist
    • Aug 2007
    • 3111

    #2
    It's been a while, but I think the class Integer could be what you're looking for. However, I'm just guessing at what some<6> may do in C++, haven't worked with generics in C++ much.

    Greetings,
    Nepomuk

    Comment

    • Tassos Souris
      New Member
      • Aug 2008
      • 152

      #3
      thanks Nepomuk but not exactly what i am looking for...

      for example i want to make a generic Vector<dim> where the user will use it as:
      Vector<2> v1;
      Vector<3> v2;

      this is possible in C++ but i think not in java as far as i know...

      Comment

      • Nepomuk
        Recognized Expert Specialist
        • Aug 2007
        • 3111

        #4
        Hm, I'm not aware of a feature like that in Java, no. You can always have an int in the constructor of course but that's as good as it gets for all I know.

        Greetings,
        Nepomuk

        Comment

        Working...