Assignment Tips

List of Common Data Structures

Java and LensKit provide a number of data structures and utilities that you will likely find useful. They include:


Java provides standard implementations of common collection types, such as maps and lists. However, due to historical compatibility considerations in the design of the Java language, these are not very efficient when storing lists or maps of numbers (e.g. longs, ints, and doubles). The Fastutil library provides collection types that are optimized for numbers and other primitives. There is a separate type (and set of implementations) for each combination of content types, following a consistent naming pattern:

Interfaces and classes exist for all primitive types, such as Long2IntMap and ByteList.

Using Fastutil types saves quite a bit of memory, and it can also save significant computation time (although recent versions of Java decrease the time penalty for not using Fastutil).

Debug Logging

The assignments are all configured to output DEBUG-level log messages to log files under the build directory when you run them via Gradle.

You can emit additional log messages using SLF4J Logger objects. We have provided them on most classes you need to modify; if one is missing, you can add it at the top of the class:

private static final Logger logger = LoggerFactory.getLogger(MyClass.class);