public Divider getDivider(Position position, PositionAdapter positionAdapter) {
    if (cache.containsPosition(position)) {
      return cache.get(position);
    }

    Divider divider = getDivider(position);

    /**
     * Once we have the divider for a single position we need to see if there is a surrounding
     * item containing a layer that has more priority.
     *
     * East position can override all north-east, east and south-east sides.
     * South-east position can only override the south-east side.
     * South position can override all south-west, south and south-east sides.
     */
    Position eastPosition = positionAdapter.getAdjacentItemPosition(position, Direction.EAST);
    Position southPosition = positionAdapter.getAdjacentItemPosition(position, Direction.SOUTH);
    Position southEastPosition =
        positionAdapter.getAdjacentItemPosition(position, Direction.SOUTH_EAST);

    Divider eastDivider = getDivider(eastPosition);
    Divider southDivider = getDivider(southPosition);
    Divider southEastDivider = getDivider(southEastPosition);

    divider = divider.overrideSublayer(eastDivider, Direction.NORTH_WEST, Direction.NORTH_EAST);
    divider = divider.overrideSublayer(eastDivider, Direction.WEST, Direction.EAST);
    divider = divider.overrideSublayer(eastDivider, Direction.SOUTH_WEST, Direction.SOUTH_EAST);
    divider = divider.overrideSublayer(southDivider, Direction.NORTH, Direction.SOUTH);
    divider = divider.overrideSublayer(southDivider, Direction.NORTH_WEST, Direction.SOUTH_WEST);
    divider = divider.overrideSublayer(southDivider, Direction.NORTH_EAST, Direction.SOUTH_EAST);
    divider =
        divider.overrideSublayer(southEastDivider, Direction.NORTH_WEST, Direction.SOUTH_EAST);

    cache.put(position, divider);

    return divider;
  }
Returns the divider for a given position.
It resolves which layer should be drawn in every different side of the item.

@param position Position of the divider
@param positionAdapter The position adapter used for the view
@return Divider for the position, properly resolved
dividers/src/main/java/com/karumi/dividers/DividerMap.java