Source:
private void populateConfigOptions() { AsyncDataProvider.getInstance().getGlusterSnapshotConfig(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { VdcQueryReturnValue vdcValue = (VdcQueryReturnValue) returnValue; Pair<List<GlusterVolumeSnapshotConfig>, List<GlusterVolumeSnapshotConfig>> configs = (Pair<List<GlusterVolumeSnapshotConfig>, List<GlusterVolumeSnapshotConfig>>) vdcValue.getReturnValue(); List<GlusterVolumeSnapshotConfig> clusterConfigOptions = configs.getFirst(); List<GlusterVolumeSnapshotConfig> volumeConfigOptions = configs.getSecond(); Collections.sort(clusterConfigOptions, new Linq.GlusterVolumeSnapshotConfigComparator()); Collections.sort(volumeConfigOptions, new Linq.GlusterVolumeSnapshotConfigComparator()); List<EntityModel<VolumeSnapshotOptionModel>> coll = new ArrayList<EntityModel<VolumeSnapshotOptionModel>>(); for (GlusterVolumeSnapshotConfig cfg : volumeConfigOptions) { EntityModel<VolumeSnapshotOptionModel> cfgModel = new EntityModel<VolumeSnapshotOptionModel>(); VolumeSnapshotOptionModel option = new VolumeSnapshotOptionModel(); option.setOptionName(cfg.getParamName()); option.setOptionValue(cfg.getParamValue()); for (GlusterVolumeSnapshotConfig clusterCfg : clusterConfigOptions) { if (clusterCfg.getParamName().equals(cfg.getParamName())) { option.setCorrespodingClusterValue(clusterCfg.getParamValue()); break; } } cfgModel.setEntity(option); existingVolumeConfigs.put(cfg.getParamName(), cfg.getParamValue()); coll.add(cfgModel); } getConfigOptions().setItems(coll); } }), selectedVolumeEntity.getClusterId(), selectedVolumeEntity.getId()); }

Target:
private void populateConfigOptions() { startProgress(null); AsyncDataProvider.getInstance().getGlusterSnapshotConfig(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { VdcQueryReturnValue vdcValue = (VdcQueryReturnValue) returnValue; Pair<List<GlusterVolumeSnapshotConfig>, List<GlusterVolumeSnapshotConfig>> configs = (Pair<List<GlusterVolumeSnapshotConfig>, List<GlusterVolumeSnapshotConfig>>) vdcValue.getReturnValue(); Map<String, String> clusterConfigOptions = new HashMap<>(); Map<String, String> volumeConfigOptions = new HashMap<>(); for (GlusterVolumeSnapshotConfig config : configs.getFirst()) { clusterConfigOptions.put(config.getParamName(), config.getParamValue()); } for (GlusterVolumeSnapshotConfig config : configs.getSecond()) { volumeConfigOptions.put(config.getParamName(), config.getParamValue()); } List<EntityModel<VolumeSnapshotOptionModel>> coll = new ArrayList<EntityModel<VolumeSnapshotOptionModel>>(); for (Map.Entry<String, String> entry : volumeConfigOptions.entrySet()) { EntityModel<VolumeSnapshotOptionModel> cfgModel = new EntityModel<VolumeSnapshotOptionModel>(); VolumeSnapshotOptionModel option = new VolumeSnapshotOptionModel(); option.setOptionName(entry.getKey()); option.setOptionValue(entry.getValue()); option.setCorrespodingClusterValue(clusterConfigOptions.get(entry.getKey())); cfgModel.setEntity(option); existingVolumeConfigs.put(entry.getKey(), entry.getValue()); coll.add(cfgModel); } getConfigOptions().setItems(coll); } }), selectedVolumeEntity.getClusterId(), selectedVolumeEntity.getId()); stopProgress(); }