opendap/src/main/java/opendap/dap/DArray.java
public void squeeze(){

        if(dimVector.size()==1)
            return;


        Vector<DArrayDimension> squeezeCandidates = new Vector<DArrayDimension>();

        for (DArrayDimension dim: dimVector){
            if(dim.getSize()==1)
                squeezeCandidates.add(dim);
        }

        if(squeezeCandidates.size()==dimVector.size())
            squeezeCandidates.remove(squeezeCandidates.size()-1);


        //LogStream.out.println("DArray.squeeze(): Removing "+
        //        squeezeCandidates.size()+" dimensions of size 1.");


        dimVector.removeAll(squeezeCandidates);

    }
public void squeeze(){

        if(dimVector.size()==1)
            return;


        Vector<DArrayDimension> squeezeCandidates = new Vector<DArrayDimension>();

        for (DArrayDimension dim: dimVector){
            if(dim.getSize()==1)
                squeezeCandidates.add(dim);
        }

        if(squeezeCandidates.size()==dimVector.size())
            squeezeCandidates.remove(squeezeCandidates.size()-1);


        //LogStream.out.println("DArray.squeeze(): Removing "+
        //        squeezeCandidates.size()+" dimensions of size 1.");


        dimVector.removeAll(squeezeCandidates);

    }
Use this method to "squeeze" out all of the array dimensions whose
size is equal to 1.
<br>
Many queries that contstrain Arrays return an Array that has dimensions
whose size has been reduced to 1. In effect that the dimension no longer
really exists, except as a notational convention for tracking the
hyperslab that the array represents. Since many clients have difficulty
handling n-dimensional arrays this method was added to allow the client
to easily "squeeze" the "extra" dimensions out of the array.