Package org.apache.commons.lang3.mutable

Examples of org.apache.commons.lang3.mutable.MutableInt


            return clone(array);
        }
        final HashMap<Integer, MutableInt> occurrences = new HashMap<Integer, MutableInt>(values.length);
        for (final int v : values) {
            final Integer boxed = Integer.valueOf(v);
            final MutableInt count = occurrences.get(boxed);
            if (count == null) {
                occurrences.put(boxed, new MutableInt(1));
            } else {
                count.increment();
            }
        }
        final BitSet toRemove = new BitSet();
        for (final Map.Entry<Integer, MutableInt> e : occurrences.entrySet()) {
            final Integer v = e.getKey();
View Full Code Here


            return clone(array);
        }
        final HashMap<Character, MutableInt> occurrences = new HashMap<Character, MutableInt>(values.length);
        for (final char v : values) {
            final Character boxed = Character.valueOf(v);
            final MutableInt count = occurrences.get(boxed);
            if (count == null) {
                occurrences.put(boxed, new MutableInt(1));
            } else {
                count.increment();
            }
        }
        final BitSet toRemove = new BitSet();
        for (final Map.Entry<Character, MutableInt> e : occurrences.entrySet()) {
            final Character v = e.getKey();
View Full Code Here

            return clone(array);
        }
        final HashMap<Long, MutableInt> occurrences = new HashMap<Long, MutableInt>(values.length);
        for (final long v : values) {
            final Long boxed = Long.valueOf(v);
            final MutableInt count = occurrences.get(boxed);
            if (count == null) {
                occurrences.put(boxed, new MutableInt(1));
            } else {
                count.increment();
            }
        }
        final BitSet toRemove = new BitSet();
        for (final Map.Entry<Long, MutableInt> e : occurrences.entrySet()) {
            final Long v = e.getKey();
View Full Code Here

            return clone(array);
        }
        final HashMap<Float, MutableInt> occurrences = new HashMap<Float, MutableInt>(values.length);
        for (final float v : values) {
            final Float boxed = Float.valueOf(v);
            final MutableInt count = occurrences.get(boxed);
            if (count == null) {
                occurrences.put(boxed, new MutableInt(1));
            } else {
                count.increment();
            }
        }
        final BitSet toRemove = new BitSet();
        for (final Map.Entry<Float, MutableInt> e : occurrences.entrySet()) {
            final Float v = e.getKey();
View Full Code Here

            return clone(array);
        }
        final HashMap<Double, MutableInt> occurrences = new HashMap<Double, MutableInt>(values.length);
        for (final double v : values) {
            final Double boxed = Double.valueOf(v);
            final MutableInt count = occurrences.get(boxed);
            if (count == null) {
                occurrences.put(boxed, new MutableInt(1));
            } else {
                count.increment();
            }
        }
        final BitSet toRemove = new BitSet();
        for (final Map.Entry<Double, MutableInt> e : occurrences.entrySet()) {
            final Double v = e.getKey();
View Full Code Here

            return clone(array);
        }
        final HashMap<Boolean, MutableInt> occurrences = new HashMap<Boolean, MutableInt>(2); // only two possible values here
        for (final boolean v : values) {
            final Boolean boxed = Boolean.valueOf(v);
            final MutableInt count = occurrences.get(boxed);
            if (count == null) {
                occurrences.put(boxed, new MutableInt(1));
            } else {
                count.increment();
            }
        }
        final BitSet toRemove = new BitSet();
        for (final Map.Entry<Boolean, MutableInt> e : occurrences.entrySet()) {
            final Boolean v = e.getKey();
View Full Code Here

  public void testGetImage() throws ServletException, IOException {
    final String resource = "picture.png";
    when( request.getParameter( RESOURCE_PARAM ) ).thenReturn( resource );

    final ServletOutputStream outputStream = mock( ServletOutputStream.class );
    final MutableInt fileLength = new MutableInt( 0 );
    doAnswer( new Answer<Void>() {
      @Override
      public Void answer( InvocationOnMock invocation ) throws Throwable {
        fileLength.add( (Integer) invocation.getArguments()[2] );
        return null;
      }
    } ).when( outputStream ).write( any( byte[].class ), anyInt(), anyInt() );
    when( response.getOutputStream() ).thenReturn( outputStream );

    servlet.service( request, response );

    verify( response ).setContentType( eq( TEST_MIME_TYPE ) );

    final int expected = new Long( new File( PentahoSystem.getApplicationContext()
      .getSolutionPath( "system/tmp/" + resource ) ).length() ).intValue();
    assertEquals( expected, fileLength.intValue() );
    verify( response ).setContentLength( eq( expected ) );
  }
View Full Code Here

        if (isEmpty(array) || isEmpty(values)) {
            return clone(array);
        }
        HashMap<T, MutableInt> occurrences = new HashMap<T, MutableInt>(values.length);
        for (T v : values) {
            MutableInt count = occurrences.get(v);
            if (count == null) {
                occurrences.put(v, new MutableInt(1));
            } else {
                count.increment();
            }
        }
        HashSet<Integer> toRemove = new HashSet<Integer>();
        for (Map.Entry<T, MutableInt> e : occurrences.entrySet()) {
            T v = e.getKey();
View Full Code Here

            return clone(array);
        }
        HashMap<Byte, MutableInt> occurrences = new HashMap<Byte, MutableInt>(values.length);
        for (byte v : values) {
            Byte boxed = Byte.valueOf(v);
            MutableInt count = occurrences.get(boxed);
            if (count == null) {
                occurrences.put(boxed, new MutableInt(1));
            } else {
                count.increment();
            }
        }
        HashSet<Integer> toRemove = new HashSet<Integer>();
        for (Map.Entry<Byte, MutableInt> e : occurrences.entrySet()) {
            Byte v = e.getKey();
View Full Code Here

            return clone(array);
        }
        HashMap<Short, MutableInt> occurrences = new HashMap<Short, MutableInt>(values.length);
        for (short v : values) {
            Short boxed = Short.valueOf(v);
            MutableInt count = occurrences.get(boxed);
            if (count == null) {
                occurrences.put(boxed, new MutableInt(1));
            } else {
                count.increment();
            }
        }
        HashSet<Integer> toRemove = new HashSet<Integer>();
        for (Map.Entry<Short, MutableInt> e : occurrences.entrySet()) {
            Short v = e.getKey();
View Full Code Here

TOP

Related Classes of org.apache.commons.lang3.mutable.MutableInt

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.