An ArrayList behaves more like a List than like an array and thus, you cannot insert element at random indexes that don't previously exist. What you classify as a flaw is a deliberate, conscious design decision. If you need a data structure where you can insert elements at random positions, you need an array. Period. Answer from desrtfx on reddit.com
🌐
Igalia
blogs.igalia.com › dpino › 2011 › 10 › 13 › configuring-different-jdks-with-alternatives
Configuring different JDKs with alternatives - Unweaving the Web
* as *‘java’*, then when later we do: ‘*alternatives –config java*‘, the alternatives for ‘*java*‘ will be listed.
🌐
Reddit
reddit.com › r/learnjava › what is an alternative of arraylist that hides its flaws?
r/learnjava on Reddit: What is an alternative of arraylist that hides its flaws?
May 1, 2019 -

So i can only store data in arraylist from the start. So is there any collection that is like an arraylist but also provides you with the benefit of adding numbers randomly at any index?

Edit: I am implementing the below program:-

 import java.util.*;
 public class Main {
 	public static void main(String[] args) {
 		HashTable h = new HashTable();
 		h.set("grey", "bad color");
 		h.set("pink", "good color");
 		h.set("orange", "good color");
 	}


 	
 }


class HashTable {
 	private ArrayList<String> keyMap;
 	private int size = 53;

 	public HashTable() {
 		this.keyMap = new ArrayList<String>(this.size);
 	}

 	public HashTable(int size) {
 		this.size = size;
 		this.keyMap = new ArrayList<String>(this.size);
 	}


 	private int _hash(String key) {
 		int total = 0;
 		int weirdPrime = 31;
 		char[] keyArr = key.toCharArray();
  		for(int i=0; i<Math.min(key.length(), 100); i++) {
  			int value = (int)keyArr[i] - 96;
  			total = (total * weirdPrime + value) % this.size;
  		}
  		return total;
 	}

 	public void set(String key, String value) {
 		int hashValue = _hash(key);
 		System.out.println(hashValue);
 		keyMap.add(value);
 	}




 }

But i get the indexOutOfBoundsException.

Discussions

spring boot - What is the alternative of List.of() in java if I'm using java 8 using STS - Stack Overflow
List.of was introduced with Java 9, and it returns an unmodifiable List. More on stackoverflow.com
🌐 stackoverflow.com
java - is there a better alternative to List<T> initalization than invoking Arrays.asList? - Stack Overflow
Is there a better alternative to using Arrays.asList as a List bulk initializer? Of concern is that this one is verbose and involves an extraneous class and method. List myList = new More on stackoverflow.com
🌐 stackoverflow.com
java - Flexible / Dynamic object creation or Alternative to list of lists - Software Engineering Stack Exchange
I have a xlsx file, that has some tabs with different data. I want to be able to save each row of a tab in a list. The first thing that comes to mind is a list of lists, but I was wondering if ther... More on softwareengineering.stackexchange.com
🌐 softwareengineering.stackexchange.com
November 27, 2013
data structures - List<Map<String, String>> alternatives (Java) - Stack Overflow
I'm fairly new in Java, and I'm making a structure for wrapping this kind of data: Object: name:'Obj1' otherAttr:'...' Object: name:'Obj2' otherAttr:'...' Object: ... I know th... More on stackoverflow.com
🌐 stackoverflow.com
🌐
Back4App
blog.back4app.com › home › learn › top 10 java alternatives
Top 10 Java Alternatives - Which is the best?
December 14, 2023 - This article will explore ten of the best Java alternatives. The list includes Kotlin, Python, Scala, Golang, Rust, Javascript, etc.
Top answer
1 of 6
536
Confusing error messages: Clojure's error messages more often than not are very confusing. They usually involve stack traces that do not thoroughly explain where the error was caused or what caused it. | Immutability is the default: Clojure programmers are highly encouraged to use immutable data in their code. Therefore, most data will be immutable by default. · State change is handled by functions (for transformations) and atoms (an abstraction that encapsulates the idea of some entity having an identity). | Minimal syntax: Being a LISP, programs are simple: they're just functions and data. That it doesn't get bogged down with syntax or the loftier FP concepts like monads makes it one of most approachable functional languages for beginners. | Tries to solve problems as simply as possible: Simplicity is one of the pillars on which Clojure is built. Clojure tries to solve many problems in software development as simply as possible. Instead of building complex interfaces, objects or factories, it uses immutability and simple data structures. | Good for writing concurrent programs: Since Clojure is designed for concurrency, it offers things like Software Transaction Memory, functional programming without side-effects and immutable data structures right out of the box. This means that the development team can focus their energies on developing features instead of concurrency details. | Huge ecosystem of libraries to work with: There's a very large ecosystem of high-quality Clojure libraries which developers can use. One example is Incanter. It's a great data analytics library and a very powerful tool for dealing with matrices, datasets and csv files. | Code tends to be nightmare to maintain for non-authors: Tendency to devolve into difficult to manage mess of styles. Not recommended for professional use. | Too cult-ish: Way too niche and in-group behavior, while trying to trash other languages. Only pays for select few, who run the "game" on others. | Cross platform: Clojure compiles to JVM bytecode and runs inside the JVM. This means that applications written in Clojure are cross-platform out of the box. | Rich Hickey: The creator is so awesome, he's a feature. Just look up his talks and see why. | Dynamic language: A superb data processing language. While rich type and specification systems are available they are optional. | Tied to the JVM and it's limitations: Some language constructs were obviously created as workarounds for JVM limitations. This makes the language much less elegant than it could have been. · Also, the JVM has a very cumbersome FFI. | Syntax can be alien / jarring for those used to other Lisps: Perhaps some may consider this attribute an advantage, but I do not. Clojure does not attempt to maintain significant compatibility with other Lisps. So, if you already know a Lisp or are used to the way Lisp works in general, you'll probably be confused if you take a look at Clojure. See these resources for more details on this subject: · - https://clojure.org/reference/lisps · - http://stackoverflow.com/q/6008313/2636454 · - http://gilesbowkett.blogspot.com/2015/01/one-major-difference-between-clojure.html · - http://softwareengineering.stackexchange.com/q/153128/166211 | Extensible: Clojure has an elegant macro system which enables language additions, Domain-specific languages (DSLs), to be created much easier than most other languages (with the exception of Racket, perhaps). | Great tool used in automating, configuring and managing dependencies available: Leiningen is a very useful tool for Clojure developers. It helps wiht automation, configuration and dependency management. It's basically a must for every Clojure project. | No C/Java syntax: Refreshing, BTW! | Game is available with which you can learn Clojure: Nightmod is a tool used to make "live-moddable" games. It displays the game's code while you are playing and allows you to inject new code using Clojure. This can be a fun and useful experience for people trying to learn Clojure. | Dynamic types: You can put anything in. This makes reasoning about code after a time has passed very hard.
2 of 6
333
Statically typed programming language for the JVM, Android and the browser.Statically typed programming language for the JVM, Android and the browser.Great tooling support: Since Kotlin is made by Jetbrains (the developers of IntelliJ IDEA) so it stands to reason that the IntelliJ support for Kotlin is also great. Besides that, Kotlin also works well with existing Java tools such as Eclipse, Maven, Gradle, Android Studio, etc... | Easy adoption for existing Java programmers: Kotlin runs on the JVM and Java interoperability has been one of the main objectives since the language was born. It runs everywhere Java does; web servers, mobile devices (Android), and desktop applications. It also works with all the major tools in the Java ecosystem like Eclipse, IntelliJ, Maven, Ant, Gradle, Spring Boot, etc. · All of this makes adoption extremely easy even for existing Java projects. On top of this there's also ensured Type safety and less boilerplate code needed. | May be hard for programmers already used to imperative style to learn functional programming from Kotlin: Since Kotlin does not enforce any particular paradigms and is not purely functional, it can be pretty easy to fall back to imperative programming habits if a programmer comes from an imperative background. | Easy to learn if you have prior programming experience: Kotlin's syntax is extremely easy to understand. The language can be picked up in a few hours just by reading the language reference. | No runtime overhead: The standard library is relatively small and tight. It mostly consists of focused extensions of the Java standard library and as such adds no additional runtime overhead to existing Java projects. | Officially supported for Android development: Starting with version 3.0 of Android Studio, Kotlin support will be built-in. This means that it's now easier than ever to use Kotlin for existing Android projects or even start writing Android apps only with Kotlin from scratch. · This also means that Kotlin and Kotlin plugins for Android Studio will be fully supported in the future and their likelihood of being abandoned is quite small since Google is fully embracing the language for their Android ecosystem (alongside Java and C++). | Low-risk adoption for existing Java codebases: Since it has such a good interoperability with Java, Java libraries, and Java tools. It can be adopted for an existing Java codebase at little to no cost. The codebase can be converted from Java to Kotlin little by little without ever disrupting the functionality of the application itself. | Does not impose a particular philosophy of programming: It's not overly OOP like Java and it does not enforce strict functional paradigms either. | Is built to solve industrial problems: Kotlin has been designed and built by developers who have an industrial background and not an academic one. As such, it tries to solve issues mostly found in industrial settings. For example, the Kotlin type system helps developers avoid null pointer exceptions. Reasearch languages usually do not have `null` at all, but APIs and large codebases usually need `null`. | The need for Java interoperability has forced some limitations: The need to make Kotlin interoperable with Java has caused some unintuitive limitations to the language design.
🌐
DEV Community
dev.to › thegroo › install-and-manage-multiple-java-versions-on-linux-using-alternatives-5e93
Install and manage multiple Java versions on Linux using alternatives - DEV Community
February 10, 2022 - sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/azul-open-jdk-17/bin/javac 2 ... sudo update-alternatives --install /usr/bin/jshell jshell /usr/lib/jvm/azul-open-jdk-17/bin/jshell 2 · Now that you have the new JDK installed and configured you can easily switch between versions using: ... Pick the number of the version you want from the Selection list.
Find elsewhere
🌐
AppDesk Services
appdeskservices.com › home › top 8 java alternatives
Top 8 Java Alternatives - 2024
April 28, 2026 - Are you tired of the same old Java? Venture into a world of diverse languages built for the JVM, each offering unique strengths. Best Java Alternatives are...
🌐
javaspring
javaspring.net › blog › java-alternative
Java Alternatives: A Comprehensive Guide — javaspring.net
Java alternatives like Kotlin, Scala, and Groovy offer unique features and benefits that can be valuable in different programming scenarios. Kotlin provides a modern and concise syntax with excellent Java interoperability.
🌐
Hackr
hackr.io › home › articles › programming
Java Alternatives: The Most Popular Java Competitors of 2026
January 30, 2025 - Looking for an alternative to Java? We cover the ten best Java alternatives, from Kotlin to Go.
🌐
Baeldung
baeldung.com › home › installation › switch between multiple java versions
Switch Between Multiple Java Versions | Baeldung on Linux
March 18, 2024 - $ update-java-alternatives --list java-1.17.0-openjdk-amd64 1711 /usr/lib/jvm/java-1.17.0-openjdk-amd64 java-1.21.0-openjdk-amd64 2111 /usr/lib/jvm/java-1.21.0-openjdk-amd64 java-1.8.0-openjdk-amd64 1081 /usr/lib/jvm/java-1.8.0-openjdk-amd64
🌐
Tech Quintal
techquintal.com › home › best › 10 best java alternatives for programmers
10 Best Java Alternatives for Programmers - Tech Quintal
October 26, 2023 - This guide aims to provide Java developers with some ideas for great alternatives to Java. It will show you both open-source and commercial platforms. As we have seen above, there are many downsides associated with using Java. So let’s look at the options, especially those that address the said issues.
Top answer
1 of 1
3

I assume that your worksheets contain tabular data, i.e., the first row contains field names and the following rows contain values. In such a case it would make sense to define a Table class whose instances would each contain the contents of one worksheet. This Table object could hold general information regarding one worksheet, if necessary, like the name of the worksheet tab.

It could also have a list holding the column names or a dictionary holding the column indexes with the column names as a key. If you define a Column class for this purpose (instead of just a string for the column name), it allows you to store additional information regarding a column, like its type (numeric, text, date) and display format.

Even if you don't need this kind of infrastructure right now, having such classes allows you to add this kind of functionality much easier later.

The Table class would also contain a list of rows. Here again, having a Row class can have advantages. However, it would be ok to represent one row as an array of strings, for instance. Since each row of the table has the same length, a list is not necessary here.

Instead of using strings to store the values, having a Value class or struct can also have advantages. Such a type could automatically convert strings to an appropriate type, could perform comparisons between values of the same type etc.

Without knowing more about your data and the kind of logic you want to apply to it, it is difficult to give you an answer tailored to fit your needs.

🌐
Coursesity
coursesity.com › blog › top-java-alternatives
Top Java Alternatives in 2025 : 15 Programming Language
December 27, 2024 - Alternatives such as C#, Python, and JavaScript are popular choices for developing web and mobile applications. These languages can provide different advantages over Java, such as better performance, more features, and more flexibility.
Top answer
1 of 6
2

If each of your objects has only these two attributes (name and otherAttr), you could create a class with fields instead of using Map:

public class Data {
    private final String name;
    private final String otherAttr;
    // constructor, getters
}

It may be useful to do so even if you have more attributes, because it gives you compile-time safety - you will never misspell a key. You can also have fields of different types, not just Strings that you would have to parse.

To make your code more meaningful you can also extend existing data structures, e.g.:

public class Data extends HashMap<String, String> {
    // extra convenience constructors
}

public class DataList extends ArrayList<Data> {
    // extra convenience constructors
}

In regards to your question what collections to use, it really depends on what you need. ArrayList is usually a good choice (or thread-safe Vector), unless you frequently modify the beginning of the list in which case LinkedList would be recommended. HashMap has very good performance, but if you need sorted data you could use TreeMap instead. If you need to maintain order of insertion LinkedHashMap will be the best.

2 of 6
2

If the structure may vary, yes, it is the correct approach.

If each name is unique, you may use a Map<String,String>.

If the structure is always the same (pairs of name and otherAttr), you may use a POJO (plain old java object), which is a fancy name for an object with getters and setters:

 public class MyData {
    private String name;
    private String otherAttr;
    public String getName() {return name;}
    public void setName(String name) {this.name=name;}
    public String getOtherAttr() {return otherAttr;}
    public void setOtherAttr(String otherAttr) {this.otherAttr=otherAttr;}
 }

Then you store them in a List<MyData>.

You may provide a constructor for MyData, setting the values of name and otherAttr

 MyData(String name, String otherAttr) {
    this.name=name;
    this.otherAttr=otherAttr
 }
🌐
Slashdot
slashdot.org › software › p › Java › alternatives
Top Java Alternatives in 2026
Find the top alternatives to Java currently available. Compare ratings, reviews, pricing, and features of Java alternatives in 2026. Slashdot lists the best Java alternatives on the market that offer competing products that are similar to Java.
Rating: 5 ​ - ​ 1 votes
🌐
SourceForge
sourceforge.net › software › product › Java › alternatives
Best Java Alternatives & Competitors
Compare Java alternatives for your business or organization using the curated list below. SourceForge ranks the best alternatives to Java in 2025.
Rating: 5 ​ - ​ 1 votes
Top answer
1 of 7
536
Confusing error messages: Clojure's error messages more often than not are very confusing. They usually involve stack traces that do not thoroughly explain where the error was caused or what caused it. | Immutability is the default: Clojure programmers are highly encouraged to use immutable data in their code. Therefore, most data will be immutable by default. · State change is handled by functions (for transformations) and atoms (an abstraction that encapsulates the idea of some entity having an identity). | Minimal syntax: Being a LISP, programs are simple: they're just functions and data. That it doesn't get bogged down with syntax or the loftier FP concepts like monads makes it one of most approachable functional languages for beginners. | Tries to solve problems as simply as possible: Simplicity is one of the pillars on which Clojure is built. Clojure tries to solve many problems in software development as simply as possible. Instead of building complex interfaces, objects or factories, it uses immutability and simple data structures. | Good for writing concurrent programs: Since Clojure is designed for concurrency, it offers things like Software Transaction Memory, functional programming without side-effects and immutable data structures right out of the box. This means that the development team can focus their energies on developing features instead of concurrency details. | Huge ecosystem of libraries to work with: There's a very large ecosystem of high-quality Clojure libraries which developers can use. One example is Incanter. It's a great data analytics library and a very powerful tool for dealing with matrices, datasets and csv files. | Code tends to be nightmare to maintain for non-authors: Tendency to devolve into difficult to manage mess of styles. Not recommended for professional use. | Too cult-ish: Way too niche and in-group behavior, while trying to trash other languages. Only pays for select few, who run the "game" on others. | Cross platform: Clojure compiles to JVM bytecode and runs inside the JVM. This means that applications written in Clojure are cross-platform out of the box. | Rich Hickey: The creator is so awesome, he's a feature. Just look up his talks and see why. | Dynamic language: A superb data processing language. While rich type and specification systems are available they are optional. | Tied to the JVM and it's limitations: Some language constructs were obviously created as workarounds for JVM limitations. This makes the language much less elegant than it could have been. · Also, the JVM has a very cumbersome FFI. | Syntax can be alien / jarring for those used to other Lisps: Perhaps some may consider this attribute an advantage, but I do not. Clojure does not attempt to maintain significant compatibility with other Lisps. So, if you already know a Lisp or are used to the way Lisp works in general, you'll probably be confused if you take a look at Clojure. See these resources for more details on this subject: · - https://clojure.org/reference/lisps · - http://stackoverflow.com/q/6008313/2636454 · - http://gilesbowkett.blogspot.com/2015/01/one-major-difference-between-clojure.html · - http://softwareengineering.stackexchange.com/q/153128/166211 | Extensible: Clojure has an elegant macro system which enables language additions, Domain-specific languages (DSLs), to be created much easier than most other languages (with the exception of Racket, perhaps). | Great tool used in automating, configuring and managing dependencies available: Leiningen is a very useful tool for Clojure developers. It helps wiht automation, configuration and dependency management. It's basically a must for every Clojure project. | No C/Java syntax: Refreshing, BTW! | Game is available with which you can learn Clojure: Nightmod is a tool used to make "live-moddable" games. It displays the game's code while you are playing and allows you to inject new code using Clojure. This can be a fun and useful experience for people trying to learn Clojure. | Dynamic types: You can put anything in. This makes reasoning about code after a time has passed very hard.
2 of 7
174
V is open-source, similar to Go and claims improvements over Go.V is open-source, similar to Go and claims improvements over Go.Fast like C: V is easier than C and fast like C. | C Interop: Can import C libraries, structs, and headers. | Cross-platform: Compile to many OSes. | Simplicity: V is simple and powerful. | Can create multi-OS GUIs: Multi-OS GUI creation is more integrated into the language than others. | Clear syntax: Highly understandable language. | Sum types: V has Sum Types. | Generics: V has generics. | Closures: V has closures, which gives the user additional options and usefulness. | Safety: V is very safe. | Single paradigm: Follows the philosophy that there should be only one way to do something, as opposed to multi-paradigm languages like C++. | Supports concurrency and channels: Can run functions concurrently that communicate over channels. | Fast compile times: Compiles programs fast, less waiting around, so more productive and fun. | Friendly and helpful community: Just check the V Discord channel or their GitHub Discussions and you will see by yourself. | Inline assembly: Can add Assembly code. | Rapid changes in a language syntax/features: Since V language under a continuous development and core syntax and features will be "frozen" in a version 1.0.0, updating from older version of a language can cause a code rewrite of previously working program. | V 1.0 release was planned for December 2019: The first version of the language was publicly released in June of 2019, version 0.1.x. First beta version of the language was released June of 2022, version 0.3. x. Language has progressed faster than most. Welcomes contributors to join the project.