Δευτέρα 27 Σεπτεμβρίου 2010

How to buy cheap books via Internet

As you probably know there are a lot of stuff that you can purchase from the Net. Usually they have nearly the same cost as in normal stores, but there are also some cases that you can find goods in much lower prices.
For instance you can purchase books from Biblio.com or other e-shops, paying even 20% of the actual price! Of course this price is a result that some books are second hand, but in fact it doesn't matter!

Notes:
About Biblio.com:
1) In some cases you might find books in biblio.com that are more expensive than in other book stores. Always compare prices before buying.
2) It is not the only book store that has cheap books.
3) It doesn't sell just second hand books.
4) In fact Biblio.com is not a store but a place where several book sellers sell there books and that's why you can find various prices for the same book.

Κυριακή 26 Σεπτεμβρίου 2010

How to retrieve the type of content used for a Collection

If you need to know what is defined for each generic type in your instance use the following piece of code

Code:
Method method = myClass.getMethod("getCalendars", null);
Type returnType = method.getGenericReturnType();
if (returnType instanceof ParameterizedType) {
ParameterizedType type = (ParameterizedType) returnType;
Type[] typeArguments = type.getActualTypeArguments();
for (Type typeArgument : typeArguments) {
Class typeArgClass = (Class) typeArgument;
System.out.println("typeArgClass = " + typeArgClass);
}
}

Comments:
1) myClass is the class that has a method named "getCalendars" which returns an instance of a class that uses generics.
2) You can try it by implementing a class that returns a "java.util.List"

LinkWithin

Blog Widget by LinkWithin

Mobile edition