General Java Questions II
Answer 1: You can t. Theoretically, some classes that implement Enumeration may
also provide some way to get a size, but you d have to know about the more specific
run time type and cast to it... and none of the standard java.util Collections classes
nor Vector or such provide these methods in their Enumeration implementations.
Answer2:  
you can make your own class like this:
import java.util.*;
public class MyEnumeration{
   int size;
   int index = 0;
   Enumeration e;
   public MyEnumeration(Vector v){
      size = v.size();
      e = v.elements();
      index = 0;
   }
   public boolean hasMoreElements(){
      return e.hasMoreElements();
   }
   public Object nextElement(){
      index++;
      return e.nextElement();
   }
   public int size(){
      return size;
   }
   public int getIndex(){
      return index;
   }
}
  
by Nicolas Delbing and Victor Vishnyakov
 Is there a way to provide values for a Vector in the source code, analogous to
array initializers?
Answer: The Vector class constuctors take no arguments other than Collection (since
JDK 1.2), which is abstract, and since a Vector is a structure whose size can change
dynamically, it s contents can only be initialaized through member methods.
  
Mike Lundy
How would I add a help file to a java application?
Would it have to be platform specific, or is there a Java api for making help files? 
If so, what is it? 
file:///F|/a_jsite/350_tips/general_java II.htm (6 of 14) [2001 07 08 11:24:53]






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java web hosting

 

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved