Here you can find the source of hasRemoval(List
Parameter | Description |
---|---|
differences | The list of differences as generated by the compareMaps() function. |
path | The path of the value in the map. |
public static boolean hasRemoval(List<String> differences, String path)
//package com.java2s; /******************************************************************************* * Copyright (c) 2012-2015 Bruno Ranschaert * Released under the MIT License: http://opensource.org/licenses/MIT * Library "jsonutil"/*from w ww . j av a2 s .c o m*/ ******************************************************************************/ import java.util.*; public class Main { /** * Check if the list of differences contains the removal of a key, the key * is a path part1.part2.part3 * * @param differences * The list of differences as generated by the compareMaps() * function. * @param path * The path of the value in the map. * @return Was the key removed from the map? */ public static boolean hasRemoval(List<String> differences, String path) { final String pattern = String.format("-%s:", path); return lookForPattern(differences, pattern); } private static boolean lookForPattern(List<String> differences, String pattern) { for (String diff : differences) { if (diff.startsWith(pattern)) { return true; } } return false; } }