Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is very language dependent. People coming from python or Java would call them lists.

Vectors are a mathematical concept unless you use c++.



In Java it’s called Vector / list refers to linked list. Python doesn’t have a linked list type so it’s kinda irrelevant. But also not every language has to be Algol centric even though Algol has largely dominated the design space of popular languages due to familiarity.


> In Java it’s called Vector / list refers to linked list

What?!! No! Vector is almost never used in Java code. When you need index-based access, ArrayList is the much more common one, and it does implement List. So I would agree with parent commenter that List is the equivalent in Java.

A List in Java is a container that allows iterating over items efficiently, but does not necessarily provide efficient random access: https://docs.oracle.com/javase/8/docs/api/java/util/List.htm...

If you care about why Vector is nearly never used: it is synchronized by default, making it slower and more complex than ArrayList. Most Java programmers would prefer to implement synchronization themselves in case multi-threading is required since it nearly always involves having to synchronize multiple list operations at the same time, which cannot be done with Vector.

It's the same reason no one uses StringBuffer, but StringBuilder.


I’m aware. The preferred name is clearly Vector and ArrayList is the wordy alternative they had to use to not break back compat. List is the name to the interface which encompasses a lot of different data types. But ask a Java programmer of they prefer to use arrays or lists and I suspect they won’t even think twice about understand that the list you’re referring to is a linked list rather than asking what you mean because arraylist implements list. A fun Java weirdness is that of course arrays themselves do not implement list


You are really out of touch, LinkedList is very widely regarded as bad for performance in nearly every scenario possible and thus hardly ever used. Array VS Arraylist is a valid question because they have very different properties.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: