Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Are arraylists redundant?

  1. #1
    Junior Member
    Join Date
    Apr 2022
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post Are arraylists redundant?

    If an array in java is re-sizeable and can contain primitive data types as well as objects, what is the point of an arraylist? Take this array of random ints for example:

    int[] intArray = {5, 243, 6766, 2, 23498, 4};

    I can add or delete however much I want from this array, so what is the point of an arraylist?

  2. #2
    Member
    Join Date
    Apr 2022
    Posts
    36
    Thanks
    0
    Thanked 8 Times in 8 Posts

    Default Re: Are arraylists redundant?

    Arrays are static elements which means that once defined the space cannot be changed. Instead the arraylists are dynamic that is the space can vary. For example if you have an arraylist in which you save user accounts for each account you should increase the space by 1 instead with the array you must immediately declare a default size.

Similar Threads

  1. Help in ArrayList of ArrayLists
    By pk_sinha53 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: July 14th, 2019, 06:17 AM
  2. Java 7 Redundant Type Argument
    By aussiemcgr in forum Java Theory & Questions
    Replies: 0
    Last Post: October 30th, 2013, 01:33 PM
  3. redundant code
    By return0 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: October 15th, 2013, 11:03 PM
  4. boolean arraylists?
    By Scorks in forum Collections and Generics
    Replies: 1
    Last Post: October 15th, 2013, 11:47 AM
  5. [SOLVED] ArrayLists - Getting index of parameters of objects of ArrayLists.
    By mwebb in forum Object Oriented Programming
    Replies: 1
    Last Post: February 16th, 2012, 07:39 PM

Tags for this Thread