Example usage for java.util List set

List of usage examples for java.util List set

Introduction

In this page you can find the example usage for java.util List set.

Prototype

E set(int index, E element);

Source Link

Document

Replaces the element at the specified position in this list with the specified element (optional operation).

Usage

From source file:com.allinfinance.startup.init.MenuInfoUtil.java

/**
 * ????/*from  w w w . ja  va2  s  .com*/
 * @param menuBean
 */
@SuppressWarnings("unchecked")
private static void addLvl3Menu(Map<String, Object> menuBean) {
    List<Object> menuLvl1List = allMenuBean.getDataList();
    for (int i = 0, n = menuLvl1List.size(); i < n; i++) {
        Map<String, Object> tmpMenuBeanLvl1 = (Map<String, Object>) menuLvl1List.get(i);
        LinkedList<Object> menuLvl2List = (LinkedList<Object>) tmpMenuBeanLvl1.get(Constants.MENU_CHILDREN);
        if (menuLvl2List == null) {
            continue;
        }
        for (int j = 0, m = menuLvl2List.size(); j < m; j++) {
            Map<String, Object> tmpMenuBeanLvl2 = (Map<String, Object>) menuLvl2List.get(j);
            //????? ?????
            if (tmpMenuBeanLvl2.get(Constants.MENU_ID).toString().trim()
                    .equals(menuBean.get(Constants.MENU_PARENT_ID).toString().trim())) {
                if (!tmpMenuBeanLvl2.containsKey(Constants.MENU_CHILDREN)) {
                    LinkedList<Object> menuLvl3List = new LinkedList<Object>();
                    menuLvl3List.add(menuBean);
                    tmpMenuBeanLvl2.put(Constants.MENU_CHILDREN, menuLvl3List);
                } else {
                    LinkedList<Object> menuLvl3List = (LinkedList<Object>) tmpMenuBeanLvl2
                            .get(Constants.MENU_CHILDREN);
                    menuLvl3List.add(menuBean);
                    tmpMenuBeanLvl2.put(Constants.MENU_CHILDREN, menuLvl3List);
                }
                menuLvl2List.set(j, tmpMenuBeanLvl2);
            }
        }
        tmpMenuBeanLvl1.put(Constants.MENU_CHILDREN, menuLvl2List);
        menuLvl1List.set(i, tmpMenuBeanLvl1);
    }
    allMenuBean.setDataList(menuLvl1List);
}

From source file:es.udc.gii.common.eaf.algorithm.operator.replace.mmga.PopulationMemoryReplaceOperator.java

private List<Individual> replaceWithNominalSolutions(MMGAAlgorithm mmga, List<Individual> toPopulation) {

    /* Find a number of non-dominated solutions in the converged population.*/
    List<Individual> nonDominatedIndividuals = MOUtil
            .findNonDominatedIndividuals(mmga.getPopulation().getIndividuals(), mmga.getElitism());

    /* For each non-dominated solution */
    for (int i = 0; i < nonDominatedIndividuals.size(); i++) {
        int index = nextIndex();

        Individual ind = nonDominatedIndividuals.get(i);
        Individual pmInd = toPopulation.get(index);

        /* Check if it dominates his match in the population memory, and if
         * so, replace the individual in the population memory. */
        if (MOUtil.checkDominance(ind, pmInd) == MOUtil.FIRST_DOMINATES) {
            toPopulation.set(index, ind);
        }// ww w .  j a  va 2  s  .  c  om
    }

    return toPopulation;
}

From source file:com.haulmont.cuba.gui.data.impl.CollectionPropertyDatasourceImpl.java

@SuppressWarnings("unchecked")
@Override/*from  ww  w . j  a va 2 s.  co m*/
public void committed(Set<Entity> entities) {
    if (!State.VALID.equals(masterDs.getState()))
        return;

    Collection<T> collection = getCollection();
    if (collection != null) {
        for (T item : new ArrayList<>(collection)) {
            for (Entity entity : entities) {
                if (entity.equals(item)) {
                    if (collection instanceof List) {
                        List list = (List) collection;
                        list.set(list.indexOf(item), entity);
                    } else if (collection instanceof Set) {
                        Set set = (Set) collection;
                        set.remove(item);
                        set.add(entity);
                    }
                    attachListener(entity);
                    fireCollectionChanged(Operation.UPDATE, Collections.singletonList(item));
                }
            }
            detachListener(item); // to avoid duplication in any case
            attachListener(item);
        }
    }

    for (Entity entity : entities) {
        if (entity.equals(item)) {
            item = (T) entity;
        }
    }

    modified = false;
    clearCommitLists();
}

From source file:com.blackducksoftware.integration.hub.detect.detector.gradle.GradleReportLine.java

public Dependency createDependencyNode(final ExternalIdFactory externalIdFactory) {
    if (!originalLine.contains(COMPONENT_PREFIX)) {
        return null;
    }/*from  ww  w . java 2 s.  co  m*/

    String cleanedOutput = StringUtils.trimToEmpty(originalLine);
    cleanedOutput = cleanedOutput
            .substring(cleanedOutput.indexOf(COMPONENT_PREFIX) + COMPONENT_PREFIX.length());

    if (cleanedOutput.endsWith(SEEN_ELSEWHERE_SUFFIX)) {
        final int lastSeenElsewhereIndex = cleanedOutput.lastIndexOf(SEEN_ELSEWHERE_SUFFIX);
        cleanedOutput = cleanedOutput.substring(0, lastSeenElsewhereIndex);
    }

    // we might need to modify the returned list, so it needs to be an actual ArrayList
    List<String> gavPieces = new ArrayList<>(Arrays.asList(cleanedOutput.split(":")));
    if (cleanedOutput.contains(WINNING_INDICATOR)) {
        // WINNING_INDICATOR can point to an entire GAV not just a version
        final String winningSection = cleanedOutput
                .substring(cleanedOutput.indexOf(WINNING_INDICATOR) + WINNING_INDICATOR.length());
        if (winningSection.contains(":")) {
            gavPieces = Arrays.asList(winningSection.split(":"));
        } else {
            // the WINNING_INDICATOR is not always preceded by a : so if isn't, we need to clean up from the original split
            if (gavPieces.get(1).contains(WINNING_INDICATOR)) {
                final String withoutWinningIndicator = gavPieces.get(1).substring(0,
                        gavPieces.get(1).indexOf(WINNING_INDICATOR));
                gavPieces.set(1, withoutWinningIndicator);
                // since there was no : we don't have a gav piece for version yet
                gavPieces.add("");
            }
            gavPieces.set(2, winningSection);
        }
    }

    if (gavPieces.size() != 3) {
        logger.error(String.format("The line can not be reasonably split in to the neccessary parts: %s",
                originalLine));
        return null;
    }

    final String group = gavPieces.get(0);
    final String artifact = gavPieces.get(1);
    final String version = gavPieces.get(2);
    final Dependency dependency = new Dependency(artifact, version,
            externalIdFactory.createMavenExternalId(group, artifact, version));
    return dependency;
}

From source file:CSVTools.CsvToolsApi.java

public List<String> replaceReservedKeyWords(List<String> header) {

    List<String> reservedKeyWords = new ArrayList<String>();

    reservedKeyWords.add("release");

    for (String currentHeader : header) {
        if (reservedKeyWords.contains(currentHeader.toLowerCase().trim())) {
            this.logger.info("Reserved keyword found");
            int index = header.indexOf(currentHeader);
            // replace the header with backticks
            header.set(index, ("`" + currentHeader + "`"));
        }/*w  w w.  j  av  a  2s  .c  o  m*/
    }
    return header;

}

From source file:edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.visitors.IsomorphismOperatorVisitor.java

@Override
public Boolean visitExchangeOperator(ExchangeOperator op, ILogicalOperator arg) throws AlgebricksException {
    AbstractLogicalOperator aop = (AbstractLogicalOperator) arg;
    if (aop.getOperatorTag() != LogicalOperatorTag.EXCHANGE)
        return Boolean.FALSE;
    // require the same partition property
    if (!(op.getPhysicalOperator().getOperatorTag() == aop.getPhysicalOperator().getOperatorTag()))
        return Boolean.FALSE;
    variableMapping.clear();//from  w  w  w . j  a va  2  s  . com
    IsomorphismUtilities.mapVariablesTopDown(op, arg, variableMapping);
    IPhysicalPropertiesVector properties = op.getPhysicalOperator().getDeliveredProperties();
    IPhysicalPropertiesVector propertiesArg = aop.getPhysicalOperator().getDeliveredProperties();
    if (properties == null && propertiesArg == null)
        return Boolean.TRUE;
    if (properties == null || propertiesArg == null)
        return Boolean.FALSE;
    IPartitioningProperty partProp = properties.getPartitioningProperty();
    IPartitioningProperty partPropArg = propertiesArg.getPartitioningProperty();
    if (!partProp.getPartitioningType().equals(partPropArg.getPartitioningType()))
        return Boolean.FALSE;
    List<LogicalVariable> columns = new ArrayList<LogicalVariable>();
    partProp.getColumns(columns);
    List<LogicalVariable> columnsArg = new ArrayList<LogicalVariable>();
    partPropArg.getColumns(columnsArg);
    if (columns.size() != columnsArg.size())
        return Boolean.FALSE;
    if (columns.size() == 0)
        return Boolean.TRUE;
    for (int i = 0; i < columnsArg.size(); i++) {
        LogicalVariable rightVar = columnsArg.get(i);
        LogicalVariable leftVar = variableMapping.get(rightVar);
        if (leftVar != null)
            columnsArg.set(i, leftVar);
    }
    return VariableUtilities.varListEqualUnordered(columns, columnsArg);
}

From source file:me.doshou.admin.maintain.staticresource.web.controller.StaticResourceVersionController.java

private String versionedStaticResourceContent(String fileRealPath, String content, String newVersion)
        throws IOException {

    content = StringEscapeUtils.unescapeXml(content);
    if (newVersion != null && newVersion.equals("1")) {
        newVersion = "?" + newVersion;
    }/*from w  w  w  . ja  va 2  s .c o m*/

    File file = new File(fileRealPath);

    List<String> contents = FileUtils.readLines(file);

    for (int i = 0, l = contents.size(); i < l; i++) {
        String fileContent = contents.get(i);
        if (content.equals(fileContent)) {
            Matcher matcher = scriptPattern.matcher(content);
            if (!matcher.matches()) {
                matcher = linkPattern.matcher(content);
            }
            if (newVersion == null) { //
                content = matcher.replaceAll("$1$2$5");
            } else {
                content = matcher.replaceAll("$1$2$3" + newVersion + "$5");
            }
            contents.set(i, content);
            break;
        }
    }
    FileUtils.writeLines(file, contents);

    return content;
}

From source file:org.optaplanner.benchmark.impl.statistic.single.constraintmatchtotalstepscore.ConstraintMatchTotalStepScoreSingleStatistic.java

@Override
public void writeGraphFiles(BenchmarkReport benchmarkReport) {
    List<Map<String, XYSeries>> constraintIdToWeightSeriesMapList = new ArrayList<Map<String, XYSeries>>(
            BenchmarkReport.CHARTED_SCORE_LEVEL_SIZE);
    for (ConstraintMatchTotalStepScoreStatisticPoint point : getPointList()) {
        int scoreLevel = point.getScoreLevel();
        if (scoreLevel >= BenchmarkReport.CHARTED_SCORE_LEVEL_SIZE) {
            continue;
        }/*from   w w w  . java  2s .com*/
        while (scoreLevel >= constraintIdToWeightSeriesMapList.size()) {
            constraintIdToWeightSeriesMapList.add(new LinkedHashMap<String, XYSeries>());
        }
        Map<String, XYSeries> constraintIdToWeightSeriesMap = constraintIdToWeightSeriesMapList.get(scoreLevel);
        if (constraintIdToWeightSeriesMap == null) {
            constraintIdToWeightSeriesMap = new LinkedHashMap<String, XYSeries>();
            constraintIdToWeightSeriesMapList.set(scoreLevel, constraintIdToWeightSeriesMap);
        }
        String constraintId = point.getConstraintPackage() + ":" + point.getConstraintName();
        XYSeries weightSeries = constraintIdToWeightSeriesMap.get(constraintId);
        if (weightSeries == null) {
            weightSeries = new XYSeries(point.getConstraintName() + " weight");
            constraintIdToWeightSeriesMap.put(constraintId, weightSeries);
        }
        long timeMillisSpent = point.getTimeMillisSpent();
        weightSeries.add(timeMillisSpent, point.getWeightTotal());
    }
    graphFileList = new ArrayList<File>(constraintIdToWeightSeriesMapList.size());
    for (int scoreLevelIndex = 0; scoreLevelIndex < constraintIdToWeightSeriesMapList
            .size(); scoreLevelIndex++) {
        XYPlot plot = createPlot(benchmarkReport, scoreLevelIndex);
        // No direct ascending lines between 2 points, but a stepping line instead
        XYItemRenderer renderer = new XYStepRenderer();
        plot.setRenderer(renderer);
        XYSeriesCollection seriesCollection = new XYSeriesCollection();
        for (XYSeries series : constraintIdToWeightSeriesMapList.get(scoreLevelIndex).values()) {
            seriesCollection.addSeries(series);
        }
        plot.setDataset(seriesCollection);
        JFreeChart chart = new JFreeChart(singleBenchmarkResult.getName()
                + " constraint match total step score diff level " + scoreLevelIndex + " statistic",
                JFreeChart.DEFAULT_TITLE_FONT, plot, true);
        graphFileList.add(
                writeChartToImageFile(chart, "ConstraintMatchTotalStepScoreStatisticLevel" + scoreLevelIndex));
    }
}

From source file:org.optaplanner.benchmark.impl.statistic.subsingle.constraintmatchtotalstepscore.ConstraintMatchTotalStepScoreSubSingleStatistic.java

@Override
public void writeGraphFiles(BenchmarkReport benchmarkReport) {
    List<Map<String, XYSeries>> constraintIdToWeightSeriesMapList = new ArrayList<Map<String, XYSeries>>(
            BenchmarkReport.CHARTED_SCORE_LEVEL_SIZE);
    for (ConstraintMatchTotalStepScoreStatisticPoint point : getPointList()) {
        int scoreLevel = point.getScoreLevel();
        if (scoreLevel >= BenchmarkReport.CHARTED_SCORE_LEVEL_SIZE) {
            continue;
        }//from  w w  w  .j a  v  a  2s .  c om
        while (scoreLevel >= constraintIdToWeightSeriesMapList.size()) {
            constraintIdToWeightSeriesMapList.add(new LinkedHashMap<String, XYSeries>());
        }
        Map<String, XYSeries> constraintIdToWeightSeriesMap = constraintIdToWeightSeriesMapList.get(scoreLevel);
        if (constraintIdToWeightSeriesMap == null) {
            constraintIdToWeightSeriesMap = new LinkedHashMap<String, XYSeries>();
            constraintIdToWeightSeriesMapList.set(scoreLevel, constraintIdToWeightSeriesMap);
        }
        String constraintId = point.getConstraintPackage() + ":" + point.getConstraintName();
        XYSeries weightSeries = constraintIdToWeightSeriesMap.get(constraintId);
        if (weightSeries == null) {
            weightSeries = new XYSeries(point.getConstraintName() + " weight");
            constraintIdToWeightSeriesMap.put(constraintId, weightSeries);
        }
        long timeMillisSpent = point.getTimeMillisSpent();
        weightSeries.add(timeMillisSpent, point.getWeightTotal());
    }
    graphFileList = new ArrayList<File>(constraintIdToWeightSeriesMapList.size());
    for (int scoreLevelIndex = 0; scoreLevelIndex < constraintIdToWeightSeriesMapList
            .size(); scoreLevelIndex++) {
        XYPlot plot = createPlot(benchmarkReport, scoreLevelIndex);
        // No direct ascending lines between 2 points, but a stepping line instead
        XYItemRenderer renderer = new XYStepRenderer();
        plot.setRenderer(renderer);
        XYSeriesCollection seriesCollection = new XYSeriesCollection();
        for (XYSeries series : constraintIdToWeightSeriesMapList.get(scoreLevelIndex).values()) {
            seriesCollection.addSeries(series);
        }
        plot.setDataset(seriesCollection);
        JFreeChart chart = new JFreeChart(subSingleBenchmarkResult.getName()
                + " constraint match total step score diff level " + scoreLevelIndex + " statistic",
                JFreeChart.DEFAULT_TITLE_FONT, plot, true);
        graphFileList.add(
                writeChartToImageFile(chart, "ConstraintMatchTotalStepScoreStatisticLevel" + scoreLevelIndex));
    }
}

From source file:com.msopentech.odatajclient.engine.it.GeoSpatialTestITCase.java

public void geoSpacialTest(final ODataPubFormat format, final String contentType, final String prefer,
        final int id) {
    try {/* www .  j  av  a  2  s  .  com*/
        final ODataEntity entity = client.getObjectFactory()
                .newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.AllSpatialTypes");
        entity.addProperty(client.getObjectFactory().newPrimitiveProperty("Id", client
                .getPrimitiveValueBuilder().setText(String.valueOf(id)).setType(EdmSimpleType.Int32).build()));

        final Point point1 = new Point(Geospatial.Dimension.GEOGRAPHY);
        point1.setX(6.2);
        point1.setY(1.1);
        final Point point2 = new Point(Geospatial.Dimension.GEOGRAPHY);
        point2.setX(33.33);
        point2.setY(-2.5);

        // create a point
        entity.addProperty(client.getObjectFactory().newPrimitiveProperty("GeogPoint", client
                .getGeospatialValueBuilder().setType(EdmSimpleType.GeographyPoint).setValue(point1).build()));

        // create  multiple point
        final List<Point> points = new ArrayList<Point>();
        points.add(point1);
        points.add(point2);
        final MultiPoint multipoint = new MultiPoint(Geospatial.Dimension.GEOGRAPHY, points);
        entity.addProperty(client.getObjectFactory().newPrimitiveProperty("GeogMultiPoint",
                client.getGeospatialValueBuilder().setType(EdmSimpleType.GeographyMultiPoint)
                        .setValue(multipoint).build()));

        // create a line
        final List<Point> linePoints = new ArrayList<Point>();
        linePoints.add(point1);
        linePoints.add(point2);
        final LineString lineString = new LineString(Geospatial.Dimension.GEOGRAPHY, linePoints);

        entity.addProperty(
                client.getObjectFactory().newPrimitiveProperty("GeogLine", client.getGeospatialValueBuilder()
                        .setType(EdmSimpleType.GeographyLineString).setValue(lineString).build()));

        // create a polygon
        linePoints.set(1, point2);
        linePoints.add(point2);
        linePoints.add(point1);
        final Polygon polygon = new Polygon(Geospatial.Dimension.GEOGRAPHY, linePoints, linePoints);
        entity.addProperty(
                client.getObjectFactory().newPrimitiveProperty("GeogPolygon", client.getGeospatialValueBuilder()
                        .setType(EdmSimpleType.GeographyPolygon).setValue(polygon).build()));

        // create a multi line string
        final List<LineString> multipleLines = new ArrayList<LineString>();
        multipleLines.add(lineString);
        multipleLines.add(lineString);
        final MultiLineString multiLine = new MultiLineString(Geospatial.Dimension.GEOGRAPHY, multipleLines);
        entity.addProperty(client.getObjectFactory().newPrimitiveProperty("GeogMultiLine",
                client.getGeospatialValueBuilder().setType(EdmSimpleType.GeographyMultiLineString)
                        .setValue(multiLine).build()));

        // create a multi polygon        
        final List<Polygon> polygons = new ArrayList<Polygon>();
        polygons.add(polygon);
        polygons.add(polygon);
        final MultiPolygon multiPolygon = new MultiPolygon(Geospatial.Dimension.GEOGRAPHY, polygons);
        entity.addProperty(client.getObjectFactory().newPrimitiveProperty("GeogMultiPolygon",
                client.getGeospatialValueBuilder().setType(EdmSimpleType.GeographyMultiPolygon)
                        .setValue(multiPolygon).build()));

        // create  acolletion of various shapes
        final List<Geospatial> geospatialCollection = new ArrayList<Geospatial>();
        geospatialCollection.add(point1);
        geospatialCollection.add(lineString);
        geospatialCollection.add(polygon);
        final GeospatialCollection collection = new GeospatialCollection(Geospatial.Dimension.GEOGRAPHY,
                geospatialCollection);
        entity.addProperty(client.getObjectFactory().newPrimitiveProperty("GeogCollection",
                client.getGeospatialValueBuilder().setType(EdmSimpleType.GeographyCollection)
                        .setValue(collection).build()));

        // with geometry test
        final Point goemPoint1 = new Point(Geospatial.Dimension.GEOMETRY);
        goemPoint1.setX(6.2);
        goemPoint1.setY(1.1);
        final Point goemPoint2 = new Point(Geospatial.Dimension.GEOMETRY);
        goemPoint2.setX(33.33);
        goemPoint2.setY(-2.5);

        // create a point
        entity.addProperty(
                client.getObjectFactory().newPrimitiveProperty("GeomPoint", client.getGeospatialValueBuilder()
                        .setType(EdmSimpleType.GeometryPoint).setValue(goemPoint2).build()));

        // create  multiple point
        final List<Point> geomPoints = new ArrayList<Point>();
        geomPoints.add(point1);
        geomPoints.add(point2);
        final MultiPoint geomMultipoint = new MultiPoint(Geospatial.Dimension.GEOMETRY, geomPoints);
        entity.addProperty(client.getObjectFactory().newPrimitiveProperty("GeomMultiPoint",
                client.getGeospatialValueBuilder().setType(EdmSimpleType.GeometryMultiPoint)
                        .setValue(geomMultipoint).build()));

        // create a line
        final List<Point> geomLinePoints = new ArrayList<Point>();
        geomLinePoints.add(goemPoint1);
        geomLinePoints.add(goemPoint2);
        final LineString geomLineString = new LineString(Geospatial.Dimension.GEOMETRY, geomLinePoints);

        entity.addProperty(
                client.getObjectFactory().newPrimitiveProperty("GeomLine", client.getGeospatialValueBuilder()
                        .setType(EdmSimpleType.GeometryLineString).setValue(geomLineString).build()));

        // create a polygon
        geomLinePoints.set(1, goemPoint2);
        geomLinePoints.add(goemPoint2);
        geomLinePoints.add(goemPoint1);
        final Polygon geomPolygon = new Polygon(Geospatial.Dimension.GEOMETRY, geomLinePoints, geomLinePoints);
        entity.addProperty(
                client.getObjectFactory().newPrimitiveProperty("GeomPolygon", client.getGeospatialValueBuilder()
                        .setType(EdmSimpleType.GeometryPolygon).setValue(geomPolygon).build()));

        // create a multi line string
        final List<LineString> geomMultipleLines = new ArrayList<LineString>();
        geomMultipleLines.add(geomLineString);
        geomMultipleLines.add(geomLineString);
        final MultiLineString geomMultiLine = new MultiLineString(Geospatial.Dimension.GEOMETRY,
                geomMultipleLines);
        entity.addProperty(client.getObjectFactory().newPrimitiveProperty("GeomMultiLine",
                client.getGeospatialValueBuilder().setType(EdmSimpleType.GeometryMultiLineString)
                        .setValue(geomMultiLine).build()));

        // create a multi polygon        
        final List<Polygon> geomPolygons = new ArrayList<Polygon>();
        geomPolygons.add(geomPolygon);
        geomPolygons.add(geomPolygon);
        final MultiPolygon geomMultiPolygon = new MultiPolygon(Geospatial.Dimension.GEOMETRY, geomPolygons);
        entity.addProperty(client.getObjectFactory().newPrimitiveProperty("GeomMultiPolygon",
                client.getGeospatialValueBuilder().setType(EdmSimpleType.GeographyMultiPolygon)
                        .setValue(geomMultiPolygon).build()));

        // create  a collection of various shapes
        final List<Geospatial> geomspatialCollection = new ArrayList<Geospatial>();
        geomspatialCollection.add(goemPoint1);
        geomspatialCollection.add(geomLineString);
        final GeospatialCollection geomCollection = new GeospatialCollection(Geospatial.Dimension.GEOMETRY,
                geomspatialCollection);
        entity.addProperty(client.getObjectFactory().newPrimitiveProperty("GeomCollection",
                client.getGeospatialValueBuilder().setType(EdmSimpleType.GeometryCollection)
                        .setValue(geomCollection).build()));

        // create request
        final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().getEntityCreateRequest(client
                .getURIBuilder(testStaticServiceRootURL).appendEntityTypeSegment("AllGeoTypesSet").build(),
                entity);
        createReq.setFormat(format);
        createReq.setContentType(contentType);
        createReq.setPrefer(prefer);
        final ODataEntityCreateResponse createRes = createReq.execute();
        final ODataEntity entityAfterCreate = createRes.getBody();
        final ODataProperty geogCollection = entityAfterCreate.getProperty("GeogCollection");
        if (format.equals(ODataPubFormat.JSON) || format.equals(ODataPubFormat.JSON_NO_METADATA)) {
            assertTrue(geogCollection.hasComplexValue());
        } else {
            assertEquals(EdmSimpleType.GeographyCollection.toString(),
                    geogCollection.getPrimitiveValue().getTypeName());

            final ODataProperty geometryCollection = entityAfterCreate.getProperty("GeomCollection");
            assertEquals(EdmSimpleType.GeographyCollection.toString(),
                    geogCollection.getPrimitiveValue().getTypeName());

            int count = 0;
            for (Geospatial g : geogCollection.getPrimitiveValue().<GeospatialCollection>toCastValue()) {
                assertNotNull(g);
                count++;
            }
            assertEquals(3, count);
            count = 0;
            for (Geospatial g : geometryCollection.getPrimitiveValue().<GeospatialCollection>toCastValue()) {
                assertNotNull(g);
                count++;
            }
            assertEquals(2, count);
        }
        // update geog points 
        final Point updatePoint1 = new Point(Geospatial.Dimension.GEOGRAPHY);
        updatePoint1.setX(21.2);
        updatePoint1.setY(31.1);
        final Point updatePoint2 = new Point(Geospatial.Dimension.GEOGRAPHY);
        updatePoint2.setX(99.99);
        updatePoint2.setY(-3.24);
        ODataProperty property = entityAfterCreate.getProperty("GeogPoint");
        entityAfterCreate.removeProperty(property);
        entityAfterCreate.addProperty(
                client.getObjectFactory().newPrimitiveProperty("GeogPoint", client.getGeospatialValueBuilder()
                        .setType(EdmSimpleType.GeographyPoint).setValue(updatePoint1).build()));
        updateGeog(format, contentType, prefer, entityAfterCreate, UpdateType.REPLACE,
                entityAfterCreate.getETag());

        // update geography line  
        final List<Point> updateLinePoints = new ArrayList<Point>();
        updateLinePoints.add(updatePoint1);
        updateLinePoints.add(updatePoint2);
        final LineString updateLineString = new LineString(Geospatial.Dimension.GEOGRAPHY, updateLinePoints);
        ODataProperty lineProperty = entityAfterCreate.getProperty("GeogLine");
        entityAfterCreate.removeProperty(lineProperty);
        entityAfterCreate.addProperty(
                client.getObjectFactory().newPrimitiveProperty("GeogLine", client.getGeospatialValueBuilder()
                        .setType(EdmSimpleType.GeographyLineString).setValue(updateLineString).build()));
        //updateGeog(format,contentType, prefer, entityAfterCreate, UpdateType.REPLACE,entityAfterCreate.getETag());

        // update a geography polygon
        updateLinePoints.set(1, updatePoint2);
        updateLinePoints.add(updatePoint2);
        updateLinePoints.add(updatePoint1);
        final Polygon updatePolygon = new Polygon(Geospatial.Dimension.GEOGRAPHY, updateLinePoints,
                updateLinePoints);
        ODataProperty polygonProperty = entityAfterCreate.getProperty("GeogPolygon");
        entityAfterCreate.removeProperty(polygonProperty);
        entityAfterCreate.addProperty(
                client.getObjectFactory().newPrimitiveProperty("GeogPolygon", client.getGeospatialValueBuilder()
                        .setType(EdmSimpleType.GeographyPolygon).setValue(updatePolygon).build()));
        //updateGeog(format,contentType, prefer, entityAfterCreate, UpdateType.REPLACE,entityAfterCreate.getETag());

        // delete the entity
        URIBuilder deleteUriBuilder = client.getURIBuilder(testStaticServiceRootURL)
                .appendEntityTypeSegment("AllGeoTypesSet(" + id + ")");
        ODataDeleteRequest deleteReq = client.getCUDRequestFactory().getDeleteRequest(deleteUriBuilder.build());
        deleteReq.setFormat(format);
        deleteReq.setContentType(contentType);
        assertEquals(204, deleteReq.execute().getStatusCode());
    } catch (Exception e) {
        LOG.error("", e);
        if (!format.equals(ODataPubFormat.JSON) && !format.equals(ODataPubFormat.JSON_NO_METADATA)) {
            fail(e.getMessage());
        }
    } catch (AssertionError e) {
        LOG.error("", e);
        fail(e.getMessage());
    }
}