573 Followers
·
Follow

How to define contractual, structural, and verifiable immutable Java collections.

Image for post
Image for post
Designing Immutable Collection using Sealed Types in JDK 15

Introducing Sealed Types

JDK 15 was released on September 15, 2020. JEP 360 Sealed Types was included as a preview feature in this release. Sealed Types is part of Project Amber. Sealed classes or interfaces can be used to restrict the interfaces or classes that are allowed to extend them. This is accomplished by using the sealed, non-sealed, and permits modifiers.

What is contractual immutability?

An interface or class is contractually immutable if the available public methods do not allow an instance to be mutated after it is constructed. A contractually immutable collection should not expose methods like add, addAll, remove, removeAll, clear and a mutable Iterator . …


Some strategies for handling exceptions in Eclipse Collections before and after Java 8

Image for post
Image for post
Handling checked exceptions with iteration patterns and lambdas can feel like walking on ice

The Inspiration for this post

Brian Vermeer wrote a great blog on Exception Handling in Java Streams.

The post reminded me of the exception handling support we have had in Eclipse Collections for a few years now. I thought I would show some simple examples of handling Checked Exceptions using Eclipse Collections before and after Java 8. I will also show examples that will work with Java Streams.

The Dependable Appendable

There is an interface in Java named Appendable. Appendable is a parent interface of StringBuilder, StringBuffer, PrintStream and several other classes. …


This is the release we’ve been waiting for.

Image for post
Image for post
Mt. Fuji in 2006

Thank you to the community

Eclipse Collections 10.2 was released in February 2020 and was a relatively small bug fix release after the somewhat monumental 10.0 release. I am happy to say that six months later, the 10.3 release has a lot of new features submitted by our outstanding community of contributors.

Thank you so much to all of the contributors who donated their valuable time to making Eclipse Collections more feature rich and even higher quality. Your efforts are very much appreciated.

If you’re thinking about contributing to an open source project but aren’t sure, check out this great blog from one of our community contributors. In the blog Sirisha Pratha explains some of the benefits she has experienced as she has become an active contributor in the OSS community. …

About

Donald Raab

Java Champion. Creator of the Eclipse Collections OSS Java library (http://www.eclipse.org/collections/). Inspired by Smalltalk. Opinions are my own.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store