Example usage for java.util LinkedHashMap equals

List of usage examples for java.util LinkedHashMap equals

Introduction

In this page you can find the example usage for java.util LinkedHashMap equals.

Prototype

boolean equals(Object o);

Source Link

Document

Compares the specified object with this map for equality.

Usage

From source file:org.apache.lens.cube.metadata.CubeMetastoreClient.java

private List<Partition> getAllLatestPartsEquivalentTo(String factOrDimtableName, String storageTableName,
        List<Partition> partitions) throws HiveException, LensException {
    if (isFactTable(factOrDimtableName)) {
        return Lists.newArrayList();
    }/*from w w  w  .  ja v a  2  s  . co  m*/
    Table storageTable = getTable(storageTableName);
    List<String> timePartCols = getTimePartColNamesOfTable(storageTable);
    List<Partition> latestParts = Lists.newArrayList();
    for (Partition partition : partitions) {
        LinkedHashMap<String, String> partSpec = partition.getSpec();
        LinkedHashMap<String, String> timePartSpec = Maps.newLinkedHashMap();
        LinkedHashMap<String, String> nonTimePartSpec = Maps.newLinkedHashMap();
        for (Map.Entry<String, String> entry : partSpec.entrySet()) {
            if (timePartCols.contains(entry.getKey())) {
                timePartSpec.put(entry.getKey(), entry.getValue());
            } else {
                nonTimePartSpec.put(entry.getKey(), entry.getValue());
            }
        }
        for (String timePartCol : timePartCols) {
            Partition latestPart = getLatestPart(storageTableName, timePartCol, nonTimePartSpec);
            if (latestPart != null) {
                LinkedHashMap<String, String> latestPartSpec = latestPart.getSpec();
                latestPartSpec.put(timePartCol, partSpec.get(timePartCol));
                if (partSpec.equals(latestPartSpec)) {
                    latestPart.getParameters().putAll(partition.getParameters());
                    latestPart.getParameters().put(getLatestPartTimestampKey(timePartCol),
                            partSpec.get(timePartCol));
                    latestPart.getTPartition().getSd().getSerdeInfo().getParameters()
                            .putAll(partition.getTPartition().getSd().getSerdeInfo().getParameters());
                    latestPart.setLocation(partition.getLocation());
                    latestPart.setInputFormatClass(partition.getInputFormatClass());
                    latestPart.setOutputFormatClass(
                            partition.getOutputFormatClass().asSubclass(HiveOutputFormat.class));
                    latestPart.getTPartition().getSd().getSerdeInfo().setSerializationLib(
                            partition.getTPartition().getSd().getSerdeInfo().getSerializationLib());
                    latestParts.add(latestPart);
                }
            }
        }
    }
    return latestParts;
}

From source file:shuffle.fwk.config.ConfigManager.java

public <T extends ConfigManager> boolean copyFromManager(T manager) {
    boolean changed = false;
    synchronized (data) {
        LinkedHashMap<String, List<String>> oldData = getDataStrings();
        data.clear();//from  w  w  w .  j  a  v  a  2s .  c o  m
        for (EntryType type : EntryType.values()) {
            LinkedHashMap<String, ConfigEntry> mappings = new LinkedHashMap<String, ConfigEntry>();
            List<String> keyOrder = new ArrayList<String>();
            for (String key : manager.getKeys(type)) {
                ConfigEntry entry = manager.getEntry(type, key);
                keyOrder.add(key);
                mappings.put(key, entry);
            }
            data.put(type, mappings);
        }
        LinkedHashMap<String, List<String>> newData = getDataStrings();
        changed |= !oldData.equals(newData);
        onCopyFrom(manager);
    }
    return changed;
}

From source file:shuffle.fwk.config.ConfigManager.java

public boolean loadFromConfig() {
    loader.setForceReload(true);//from   ww  w. j  a  va 2  s. c o m
    boolean changed = false;
    synchronized (data) {
        LinkedHashMap<String, List<String>> oldData = getDataStrings();
        data.clear();
        for (EntryType type : EntryType.values()) {
            LinkedHashMap<String, ConfigEntry> mappings = loader.getMappings(type);
            data.put(type, mappings);
        }
        maintainVersion();
        LinkedHashMap<String, List<String>> newData = getDataStrings();
        changed |= !oldData.equals(newData);
        if (changed) {
            savedDataStrings.clear();
            savedDataStrings.putAll(newData);
        }
    }
    return changed;
}