GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  J2EE  >  Java
Go To First  |  Previous Question  |  Next Question 
 Java  |  Question 925 of 928    Print  
Implement ArrayList
How do you implement ArrayList without using Collections in Java?


  
Total Answers and Comments: 1 Last Update: October 31, 2009     Asked by: naveed_osi 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
October 30, 2009 12:29:02   #1  
kneebrains Member Since: October 2009   Contribution: 2    

RE: Implement ArrayList
def size 10
def loadfactor 0.75
def myarray Object[size]
def cursor 0
def threshold (int)(size * loadfactor)

def add(obj)
if cursor < threshold
myarray[cusror++] obj
else
def newarr Object[size * 2]
System.arrayCopy (newarr myarray 0 myarray.size) // copy over all items to new
myarray newarr
size size * 2
threshold (int)(size * loadfactor)
myarray[cusror++] obj
fi
end

 
Is this answer useful? Yes | No

 Related Questions

The Vector class provides the capability to implement a growable array of objects 
Latest Answer : A vector implements dynamic array, which can grow and shrink dynamically.It is similar to Arraylist with a difference that vector can be synchronized. it also contain some legacy methods. ...

An anonymous class may implement an interface or extend a superclass, but may not bedeclared to do both. 

It must provide all of the methods in the interface and identify the interface in itsimplements clause. 
Latest Answer : interface enhance the concepts of inheritence. by calling multiple interfaces to class we can also inherinting more than a class indirectly ...

What is the difference between the JDK 1.02 event model and the event-delegationmodel introduced with JDK 1.1
The JDK 1.02 event model uses an event inheritance or bubbling approach. In this model,components are required to handle their own events. If they do not handle a particularevent, the event is inherited 

An object must implement the Serializable or Externalizable interface before it can bewritten to a stream as an object. 

All tasks must implement the run() method, whether they are a subclass of Thread orimplement the Runnable interface. 

A thread class may be declared as a subclass of Thread, or it may implement theRunnable interface. 

Latest Answer : One more point :Vector defaults to doubling the size of its array, while the ArrayList increases its array size by 50 percent. ...

Latest Answer : The Vector and ArrayList classes are implemented using dynamically resizable arrays, providing fast random access and fast list traversal—very much like using an ordinary array. Unlike the ArrayList class, the Vector class is thread-safe, meaning ...

The Vector class provides the capability to implement a growable array of objects 
Latest Answer : Vector implements a dynamic array at run tme and it works as arraylsi,but it is synchronizedand not part of the collection framework ...


 Sponsored Links

 
Related Articles

Service Oriented Java Business Integration Review

Service Oriented Java Business Integration Review Introduction If you ve read through the texts which give you an introduction to SOA or Web Services you will often find them to be quite frustrating and the reason for this is because they spend too much time referencing business processes which are
 

Java and Client Server Models

Java and Client Server Models The Role of Client Servers on the Web Client server models provide the essential mechanisms for working with the Internet In fact most of the World Wide Web is built according to this paradigm In client server models the web browsers run by millions of users are the cli
 

The Interview Snafu

How to turn someone else&rsquo;s mistake to your advantage Your dream job is about to become reality. A recruiter gave you the heads up about the perfect position at Humungous Conglomerate, Inc. You went through five interviews as well as a battery of psychological tests mandated by their HR de
 

Winning a Job Interview with a Winning Resume

Does your resume unlock your potential, take your skills to the highest level and win you the interview and the job you want now? The job market today is highly competitive and even if you think you have what it takes to get an interview you won&rsquo;t get over the line without a polished, prof
 

Using UML with Java

Using UML with Java While Java is not a new language its application for the development of embedded systems is quite new Developers are beginning to take a second look at modeling languages such as UML and many feel it can be a powerful tool in their development arsenal mosgoogle center Introductio
 

Importance of Proper English during Job Interview

Importance of Proper English during Job Interview Your job interview is crucially important and it will determine whether or not you will get the job Depending on the type of job you re going for it is very important for you to use proper English In most cases jobs which offer higher salaries will h
 

Java Technology Trends

Technology Trends Involving Java Java is an object oriented programming language OOP for Web browsers It is organized around data rather than actions and supports polymorphism which allows the same code to be written generically so it can function with different datatypes inheritance which allows on
 

HR Interview - HR Interview Mistakes You Will Want To Avoid

HR Interview Mistakes You Will Want To Avoid The job interview can be a stressful process This is especially true for those who are going after a competitive position Your nonverbal communication combined with the answers you give during the interview will determine if you are hired mosgoogle While
 

HR Interview - Behavioral HR Interviews

Behavioral HR Interviews As the name implies a behavioral interview is an interview that is held by a human resources department to determine if an applicant has the behaviors that are appropriate for a job The company must know how an applicant will behave in a certain situations mosgoogle The logi
 

HR Interview - How To Prepare For Your HR Interview

How To Prepare For Your HR Interview Before you begin thinking about how you are going to dress for the interview it is important to do your research first You should learn everything you can about the company you wish to work for When you have detailed information about your employer you will conve
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape