AnyLogic release with Java 11

AnyLogic 8.8.0 is now released and available for download.

The question is not if you should move to Java 11 or a later version, but when.

And so, the time has come. In AnyLogic 8.8.0 we’ve switched the API (“language level”) from Java 8 to Java 11. In some of the previous software releases, we already started shipping AnyLogic with Java 11 Runtime Environment.

However, the models built in those AnyLogic versions were compiled in a “Java 8 way”. Thanks to this, you could run your models in Java 8 environments, for example, in the AnyLogic Private Cloud versions below 2.3.0.

Additionally, the AnyLogic 8.8.0 release comes with enhancements for Material Handling, Process Modeling, and Rail Libraries — see the complete list in the release notes →

Java-related changes in this release will be useful for developers and those working with code in AnyLogic. Let's take a closer look.

Language feature

Java 11 introduced a language feature — the ability to use the var keyword which had initially appeared in Java 10. This change makes your code simpler:

var list = List.of("a", "b"); 

instead of

List<String> list = List.of("a", "b");

Developer features

Easy creation of collections

Set.of("a", "b")

instead of

new HashSet<>(Arrays.asList("a", "b"))

Converting a collection to an array

This makes it easier to create an array of the right type from a collection:


instead of

list.toArray(new String[list.size()])

New String methods

These methods reduce the amount of boilerplate-code involved in manipulating string objects and save you from having to import libraries. The methods include:

isBlank() — checks for empty and whitespaces-only strings
lines() — allows iteration over text lines using Stream API, for example:

var max = text.lines()

Strings from files

It is now easier to read and write Strings from files:

var filePath = Path.of("my_file.txt");
Files.writeString(filePath, "Some text");
var textFromFile = Files.readString(filePath);

New advanced functions

Experienced developers can now benefit from convenient API of Optional and Stream classes:

Optional.isEmpty(), Optional.or(alternative),, Stream.takeWhile(), Stream.iterate()

Download AnyLogic 8.8.0 from our website or update it from within the software.

Related posts