diff --git a/src/org/openstreetmap/josm/gui/mappaint/DividedScale.java b/src/org/openstreetmap/josm/gui/mappaint/DividedScale.java
index 4406051..50f6002 100644
--- a/src/org/openstreetmap/josm/gui/mappaint/DividedScale.java
+++ b/src/org/openstreetmap/josm/gui/mappaint/DividedScale.java
@@ -117,7 +117,7 @@ public class DividedScale<T> {
      * @param lower lower bound
      * @param upper upper bound
      */
-    protected void putImpl(T o, double lower, double upper) {
+    private void putImpl(T o, double lower, double upper) {
         int i = 0;
         while (bd.get(i) < lower) {
             ++i;
@@ -163,6 +163,10 @@ public class DividedScale<T> {
         }
     }
 
+    /**
+     * Runs a consistency test.
+     * @throws AssertionError When an invariant is broken.
+     */
     public void consistencyTest() {
         if (bd.size() < 2) throw new AssertionError(bd);
         if (data.isEmpty()) throw new AssertionError(data);
diff --git a/src/org/openstreetmap/josm/gui/mappaint/StyleCache.java b/src/org/openstreetmap/josm/gui/mappaint/StyleCache.java
index d3f2cea..3c640ec 100644
--- a/src/org/openstreetmap/josm/gui/mappaint/StyleCache.java
+++ b/src/org/openstreetmap/josm/gui/mappaint/StyleCache.java
@@ -8,6 +8,8 @@ import org.openstreetmap.josm.tools.Pair;
 
 /**
  * Caches styles for a single primitive.
+ * <p>
+ * This object is immutable.
  */
 public final class StyleCache {
 
@@ -30,16 +32,22 @@ public final class StyleCache {
     private StyleCache() {
     }
 
+    /**
+     * Creates a new copy of this style cache with a new entry added.
+     * @param o The style to cache.
+     * @param r The range the style is for.
+     * @param selected The style list we should use (selected/unselected)
+     * @return The new object.
+     */
     public StyleCache put(StyleElementList o, Range r, boolean selected) {
         StyleCache s = new StyleCache(this);
 
         int idx = getIndex(selected);
         DividedScale<StyleElementList> ds = s.states[idx];
         if (ds == null) {
-            ds = s.states[idx] = new DividedScale<>();
+            ds = new DividedScale<>();
         }
-        ds.putImpl(o, r.getLower(), r.getUpper());
-        ds.consistencyTest();
+        s.states[idx] = ds.put(o, r);
         s.intern();
         return s;
     }
