private LogHistory()

in unit/BasicUnitAndroidTest/app/src/main/java/com/example/android/testing/unittesting/basicunitandroidtest/LogHistory.java [91:114]


    private LogHistory(Parcel in) {
        // First, read the size of the arrays that contain the data.
        int length = in.readInt();

        // Create the arrays to store the data.
        String[] texts = new String[length];
        long[] timestamps = new long[length];

        // Read the arrays in a specific order.
        in.readStringArray(texts);
        in.readLongArray(timestamps);

        // The lengths of both arrays should match or the data is corrupted.
        if (texts.length != timestamps.length) {
            throw new IllegalStateException("Error reading from saved state.");
        }

        // Reset the data container and update the data.
        mData.clear();
        for (int i = 0; i < texts.length; i++) {
            Pair<String, Long> pair = new Pair<>(texts[i], timestamps[i]);
            mData.add(pair);
        }
    }