Re: Generics data type and interfaces Programming Software Development by Ketsuekiame Generics are used when you can apply the same situation to … things like adding a Double to a list of ints. Generics can be as complicated or simple as you want them… useful and powerful, especially when combined with reflection. Another place generics can be used is on Method definitions. For example: Factory… Generics and += Programming Software Development by sciwizeh … can be any type. The problem I have is that generics can only hold objects, so when I try to say… number, but the autoboxing doesn't seem to work with generics. can anyone help? Generics? Programming Software Development by iamthwee How can I put this? Is generics only supported by the very recent versions of java? If so... Does that mean if I use it, it might not work for people who have older versions of the JVM, or java plugin or whatever it is? Re: Generics? Programming Software Development by iamthwee [QUOTE=iamthwee]Thanx for clarifying that kiddo.[/QUOTE] Hmmm...In that case, if I'm designing a program to be eventually released into the public domain, would it be unadvisable to be using generics...do ya think? Generics help Programming Software Development by stevebush Hi, I am working on assignments that deal with Generics in java. I have a class Movie that have a … Generics help Programming Software Development by BuhRock … methods. I'm having trouble because I've never used Generics before. My professor created some methods, but I don't… Re: Generics Real world example Programming Software Development by Rashakil Fol …mistake and putting something of the wrong type in. Generics also let you make guarantees that somebody's passing something…comparer intend to operate on things of type T. Without generics, you'd have to write something like [code] …question asking what are the most common practical uses of generics. The most common is the simple use of generic… Generics problem when compiling code Programming Software Development by Acidburn …'m really puzzled about this error: [quote] Error 1 Feature 'generics' cannot be used because it is not part of the…\dissertation\custom_plugin\myProtocolPlugin\myProtocolPlugin\Commands.cs 9 54 myProtocolPlugin [/quote] Generics IS supported, I've done it on more than one… Generics Real world example Programming Software Development by linkpraveen Where ever i see i find a Stack example on generics.. can anyone please point me to some real world example or sample project using Generics. Regards Praveen Generics data type and interfaces Programming Software Development by rotten69 Hi everyone, we were taught about Generics and Interfaces at uni and I wasn't sure what … methods as long as they extend the interfaces. As for generics, as far as I understand them, you make your own… Re: generics in java Programming Software Development by Ezzaral … "abstraction" in your original question - not generics, based on the question. Generics are a type parameterization mechanism introduced in Java… Re: Generics problem when compiling code Programming Software Development by sknake … any of the C# 2.0 compiler features such as generics or anonymous methods with the ISO-1 compatibility option. The… Re: Generics Real world example Programming Software Development by kvprajapati …;http://msdn.microsoft.com/en-us/library/512aeb7t.aspx"]Generics C# Programming Guide[/URL] Re: Generics data type and interfaces Programming Software Development by Ketsuekiame …; _dataAccessObject.SaveMyObject(currentObject); } } You could also combine the above with Generics, to make the interface more powerful. ie public interface IDataAccess… generics in java Programming Software Development by paradox814 I am using generics in java, and I want to know how I can test to see if I have a int or a float? Is there some sort of type-testing? I'm sure there is, I just need someone to help point me in the right direction. Thanks! Re: generics in java Programming Software Development by jwenting huh? What are you trying to do? If you have to worry about the exact type of a genericised argument to a method the decision to use generics at that stage was wrong. Re: generics in java Programming Software Development by jwenting If your method implementation can work with both integer and floating point numbers, why handle them differently? If it can't, why use generics to template away the difference in the method signature? I assume you pass in an argument of type <E extends Number> ? Re: Generics Programming Software Development by iamthwee [url=http://66.102.9.104/search?q=cache:FiiQnFUy0CsJ:java.sun.com/j2se/1.5/pdf/generics-tutorial.pdf+java+generics+tutorials&hl=en&ct=clnk&cd=1&gl=uk]here?[/url] Re: Generics Programming Software Development by alba07 Thanks for the resource. If I am understaning this right I now can write: public class Variable<T>{ (etc). or does Variable extend <Variable T>. I am sorry I am still a bit lost, I am new to generics and the more I read about them the more confused I seem to get. Re: Generics and += Programming Software Development by javaAddict Can we see part of the code? Re: Generics and += Programming Software Development by masijade You might also explain what you mean by "cannot do that". And explain [i]exactly[/i] what "vec.x" is, as that is not how you access something in a vector. But, of course, don't forget the actual code. Re: Generics and += Programming Software Development by sciwizeh what i mean by "cannot do that" is that because of the generic within the class trying to take the component x of type <T> and add it to another Java won't accept that as correct. here is the code that is causing the problem [code=java]package cannonfodder; /** * @author Bill * @param <T> type */ public class Vector <… Re: Generics and += Programming Software Development by BestJewSinceJC The + operator only works with certain types. If you aren't using it with those types, then it isn't going to work. If you want more detailed reasoning on this, masijade is probably your man. But you should try using the floatValue method of the Number class, then adding the floats you get. But for example, Number could be a BigDecimal, BigInteger,… Re: Generics and += Programming Software Development by masijade Nope, it can't, mainly because Number itself can't use those operators, only a little over half the classes that extend Number can use those operators (only through autoboxing of course, which Number, of course, also can't do). The compiler can only work with what it [i]knows[/i] it has, and in this case, that is "Number", and "… Re: Generics and += Programming Software Development by sciwizeh Thanks, perhaps I'll just make it for only one type. The reason I wanted this is because I wanted to have a position in an array as a vector which has to be an int, but I also wanted to be able to have a vector that was in doubles for things like forces velocity and acceleration. but I suppose I will either have to make due with one, or write both … Re: Generics? Programming Software Development by server_crash It's supported by >= 1.5. Anything written in 1.5 (no matter how the syntax is written) will not work on <= 1.4 machines. I've tried adding source flags and doing a bunch of other stuff and it never made it an actual 1.4 program. The JVM implementation details will always be different. So no, it will not work on older versions of … Re: Generics? Programming Software Development by iamthwee Thanx for clarifying that kiddo. Re: Generics? Programming Software Development by jwenting no, since there is no reason for most of your potential users not to have a 1.5 JVM installed. There are a few operating systems that don't have one available, but not a lot of people use those, certainly not a lot of people using public domain software. Re: Generics? Programming Software Development by jwenting and yes, I know that sounds elitist ;) But the platforms that don't have a 1.5 JVM are mainly mainframe and big Unix servers running things like AIX and OpenUnix. Those run mainly custom software. Re: Generics help Programming Software Development by JamesCherrill If ExtendedMovie extends Movie then you can access the name via the inherited accessor methods of the Movie class