GithubHelp home page GithubHelp logo

ArrayList vs List about 2122-s2 HOT 3 OPEN

yongchein-o avatar yongchein-o commented on August 11, 2024
ArrayList vs List

from 2122-s2.

Comments (3)

FYimu avatar FYimu commented on August 11, 2024

Hint: ArrayList implements List interface

from 2122-s2.

calvinseptyanto avatar calvinseptyanto commented on August 11, 2024

If I am not wrong, List is an interface, and you cannot instantiate an interface. That's why you need some implementation, in this case, prof uses ArrayList (under List interface), which is basically a List implemented over an array. Can also check https://www.geeksforgeeks.org/difference-between-list-and-arraylist-in-java/

So from line 16, it will invoke the constructor at line 11, and because of what I mentioned above, there will be no error occurred as ArrayList implements the List interface.

Really sorry if there's a misconception, but if anyone would like to correct me or add something on, please go ahead!

from 2122-s2.

hwkchia avatar hwkchia commented on August 11, 2024

Refer to Lecture #1 Slide #15. The code snippet shows that ArrayList (or LinkedList) is a List. More shall be reviewed in Lecture #5. πŸ˜ƒ

from 2122-s2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.