Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Spring Framework | Web Services | BioInformatics | Java Server Faces | Jboss 3.0 tutorial | Hibernate 3.0 | XML

Tutorial Categories: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML


 

Java Tutorials


 

 

Struts Tutorials

Struts Resources

Visit Forum! Post Questions!
Jobs At RoseIndia.net!

Java Notes

Java Data Structures

[an error occurred while processing this directive]

Term "Collections". The overall term for Java's data structure facilities is Collections, a term is is an alternative to the more common Data Structures. In addition to describing general data structure facilities, java.util.Collection is the name of an interface and java.util.Collections is the name of a class containing many data structure utility methods. Three different names would have been better.

Use the Java library - Don't write your own

Most data structure textbooks give students the impression that professional programmers implement basic data structures, such as linked lists, or write their own sort methods.

This is completely false! Many standard data structures and algorithms have already been written and are available in Java. Professional programmers use these library classes as building blocks for their application specific structures.

Textbooks give this distorted view because their emphasis is on understanding how data structures are build using only pointers/references and arrays. It's an excellent exercise and is necessary to becoming a good programmer. But textbooks often fail to emphasize the predefined data structure libraries that programmers actually use.

You will, of course, often write data structures that reflect the nature of your problem, but use the library versions for the basic elements. And you will have plenty of opportunities to use this basic knowledge to to beyond the basics.

Productivity is much higher with the standard libraries

To be a productive programmer, your first choice must be to use standard library data structures. In Java this means using the Collection classes and interfaces. If you can't find what you need, try one of the Alternative Data Structures libraries.

You will always have to write some of your own data structures, but you can program faster, and produce more robust and readable programs by building on the work of others.

The Collections data structures are good, but ...

No primitive types. Collections data structures work only with objects, not primitive values. You can use the wrapper classes (somewhat more convenient in Java 5), use alternate libraries, or write your own class equivalents. The creation and garbage collection of these extra objects may add substantial overhead. There are several non-Sun implementations of data structures using primitives.

Pre-Java 5 Downcasting from Object In versions before Java 5 a problem is that an object returned from a data structure must be downcast to whichever type you want. This was a constant annoyance, and was a form of weak-typing, which allowed run-time type mismatches that should be caught at compile time. Generic types, as in C++ templates, are in Java 5 to enforce typing and remove the need for explicit casting. For compatibility the older versions of the classes also work.

Missing facilities Many obvious additions can be found in Alternative Data Structures.

Ask programming questions?

 

 

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

2 comments so far (post your own) View All Comments Latest 10 Comments:

i want data st throug java notes

Posted by prasad on Friday, 05.8.09 @ 11:53am | #87508

tutorial

Posted by nagamani on Wednesday, 01.21.09 @ 00:58am | #83996

  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification

Tell A Friend
Your Friend Name

 

 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright 2007. All rights reserved.

[an error occurred while processing this directive]