static List<Integer> doubleDeltaEncode(List<Integer> list) {
        if (list == null) {
            return null;
        }

        ArrayList<Integer> result = new ArrayList<>();
        if (list.isEmpty()) {
            return result;
        }

        Iterator<Integer> it = list.iterator();
        // add the first way node to the result list
        Integer prevLat = it.next();
        Integer prevLon = it.next();

        Integer prevLatDelta = Integer.valueOf(0);
        Integer prevLonDelta = Integer.valueOf(0);

        result.add(prevLat);
        result.add(prevLon);

        while (it.hasNext()) {
            Integer currentLat = it.next();
            Integer currentLon = it.next();
            Integer deltaLat = Integer.valueOf(currentLat.intValue() - prevLat.intValue());
            Integer deltaLon = Integer.valueOf(currentLon.intValue() - prevLon.intValue());

            result.add(Integer.valueOf(deltaLat.intValue() - prevLatDelta.intValue()));
            result.add(Integer.valueOf(deltaLon.intValue() - prevLonDelta.intValue()));

            prevLat = currentLat;
            prevLon = currentLon;
            prevLatDelta = deltaLat;
            prevLonDelta = deltaLon;
        }

        return result;
    }
@Test
    public void testDoubleDeltaEncode() {
        List<Integer> ddeltaEncoded = DeltaEncoder.doubleDeltaEncode(this.mockCoordinates);
        Assert.assertEquals(Integer.valueOf(52000000), ddeltaEncoded.get(0));
        Assert.assertEquals(Integer.valueOf(13000000), ddeltaEncoded.get(1));
        Assert.assertEquals(Integer.valueOf(100), ddeltaEncoded.get(2));
        Assert.assertEquals(Integer.valueOf(100), ddeltaEncoded.get(3));
        Assert.assertEquals(Integer.valueOf(300), ddeltaEncoded.get(4));
        Assert.assertEquals(Integer.valueOf(300), ddeltaEncoded.get(5));
        Assert.assertEquals(Integer.valueOf(-500), ddeltaEncoded.get(6));
        Assert.assertEquals(Integer.valueOf(-500), ddeltaEncoded.get(7));
        Assert.assertEquals(Integer.valueOf(500), ddeltaEncoded.get(8));
        Assert.assertEquals(Integer.valueOf(500), ddeltaEncoded.get(9));
        Assert.assertEquals(Integer.valueOf(-200), ddeltaEncoded.get(10));
        Assert.assertEquals(Integer.valueOf(-200), ddeltaEncoded.get(11));
    }