Tabnine Logo
ArrayUtils
Code IndexAdd Tabnine to your IDE (free)

How to use
ArrayUtils
in
org.glassfish.grizzly.utils

Best Java code snippets using org.glassfish.grizzly.utils.ArrayUtils (Showing top 20 results out of 315)

origin: javaee/grizzly

/**
 * Add unique element to the array.
 * @param <T> type of the array element
 * @param array array
 * @param element element to add
 *
 * @return array, which will contain the new element. Either new array instance, if
 * passed array didn't contain the element, or the same array instance, if the element
 * is already present in the array.
 */
public static <T> T[] addUnique(T[] array, T element) {
  return addUnique(array, element, true);
}
origin: javaee/grizzly

/**
 * {@inheritDoc}
 */
@Override
public boolean containsAll(Collection<?> collection) {
  if (collection.isEmpty()) {
    return true;
  }
  final Object[] localArray = array;
  for (Object element : collection) {
    if (ArrayUtils.indexOf(localArray, element) == -1) {
      return false;
    }
  }
  return true;
}
origin: javaee/grizzly

/**
 * Remove element(s) from the set.
 *
 * @param elements the element(s) to remove.
 * @return <tt>true</tt>, if at least one element was found and removed,
 * or <tt>false</tt> otherwise.
 */
public final boolean removeAll(Object... elements) {
  if (elements.length == 0) {
    return false;
  }
  synchronized (sync) {
    if (array == null) {
      return false;
    }
    boolean result = false;
    for (Object element : elements) {
      final T[] oldArray = array;
      array = ArrayUtils.remove(array, element);
      result |= (oldArray != array);
    }
    return result;
  }
}
origin: javaee/grizzly

private void recalcIndex(final int index) {
  final int idx = index < bufferBounds[0]
      ? 0 
      : ArrayUtils.binarySearch(bufferBounds, 0,
      buffersSize - 1, index + 1);
  
  activeBuffer = buffers[idx];
  upperBound = bufferBounds[idx];
  lowerBound = upperBound - activeBuffer.remaining();
  lastSegmentIndex = idx;
  activeBufferLowerBound = lowerBound - activeBuffer.position();
}
origin: javaee/grizzly

private void recalcIndex(final int index) {
  final int idx = index < bufferBounds[0]
      ? 0 
      : ArrayUtils.binarySearch(bufferBounds, 0,
      buffersSize - 1, index + 1);
  
  activeBuffer = buffers[idx];
  upperBound = bufferBounds[idx];
  lowerBound = upperBound - activeBuffer.remaining();
  lastSegmentIndex = idx;
  activeBufferLowerBound = lowerBound - activeBuffer.position();
}
origin: javaee/grizzly

/**
 * Add unique element to the array.
 * @param <T> type of the array element
 * @param array array
 * @param element element to add
 *
 * @return array, which will contain the new element. Either new array instance, if
 * passed array didn't contain the element, or the same array instance, if the element
 * is already present in the array.
 */
public static <T> T[] addUnique(T[] array, T element) {
  return addUnique(array, element, true);
}
origin: org.glassfish.grizzly/grizzly-websockets-server

/**
 * {@inheritDoc}
 */
@Override
public boolean containsAll(Collection<?> collection) {
  if (collection.isEmpty()) {
    return true;
  }
  final Object[] localArray = array;
  for (Object element : collection) {
    if (ArrayUtils.indexOf(localArray, element) == -1) {
      return false;
    }
  }
  return true;
}
origin: javaee/grizzly

private void recalcIndex(final int index) {
  final int idx = index < bufferBounds[0]
      ? 0 
      : ArrayUtils.binarySearch(bufferBounds, 0,
      buffersSize - 1, index + 1);
  
  activeBuffer = buffers[idx];
  upperBound = bufferBounds[idx];
  lowerBound = upperBound - activeBuffer.remaining();
  lastSegmentIndex = idx;
  activeBufferLowerBound = lowerBound - activeBuffer.position();
}
origin: org.glassfish.grizzly/grizzly-websockets-server

/**
 * Remove element(s) from the set.
 *
 * @param elements the element(s) to remove.
 * @return <tt>true</tt>, if at least one element was found and removed,
 * or <tt>false</tt> otherwise.
 */
public final boolean removeAll(Object... elements) {
  if (elements.length == 0) {
    return false;
  }
  synchronized (sync) {
    if (array == null) {
      return false;
    }
    boolean result = false;
    for (Object element : elements) {
      final T[] oldArray = array;
      array = ArrayUtils.remove(array, element);
      result |= (oldArray != array);
    }
    return result;
  }
}
origin: javaee/grizzly

/**
 * Add unique element to the array.
 * @param <T> type of the array element
 * @param array array
 * @param element element to add
 *
 * @return array, which will contain the new element. Either new array instance, if
 * passed array didn't contain the element, or the same array instance, if the element
 * is already present in the array.
 */
public static <T> T[] addUnique(T[] array, T element) {
  return addUnique(array, element, true);
}
origin: javaee/grizzly

/**
 * {@inheritDoc}
 */
@Override
public boolean containsAll(Collection<?> collection) {
  if (collection.isEmpty()) {
    return true;
  }
  final Object[] localArray = array;
  for (Object element : collection) {
    if (ArrayUtils.indexOf(localArray, element) == -1) {
      return false;
    }
  }
  return true;
}
origin: org.mule.glassfish.grizzly/grizzly-framework

private void recalcIndex(final int index) {
  final int idx = index < bufferBounds[0]
      ? 0 
      : ArrayUtils.binarySearch(bufferBounds, 0,
      buffersSize - 1, index + 1);
  
  activeBuffer = buffers[idx];
  upperBound = bufferBounds[idx];
  lowerBound = upperBound - activeBuffer.remaining();
  lastSegmentIndex = idx;
  activeBufferLowerBound = lowerBound - activeBuffer.position();
}
origin: javaee/grizzly

/**
 * Remove element(s) from the set.
 *
 * @param elements the element(s) to remove.
 * @return <tt>true</tt>, if at least one element was found and removed,
 * or <tt>false</tt> otherwise.
 */
public final boolean removeAll(Object... elements) {
  if (elements.length == 0) {
    return false;
  }
  synchronized (sync) {
    if (array == null) {
      return false;
    }
    boolean result = false;
    for (Object element : elements) {
      final T[] oldArray = array;
      array = ArrayUtils.remove(array, element);
      result |= (oldArray != array);
    }
    return result;
  }
}
origin: javaee/grizzly

/**
 * Add unique element to the array.
 * @param <T> type of the array element
 * @param array array
 * @param element element to add
 *
 * @return array, which will contain the new element. Either new array instance, if
 * passed array didn't contain the element, or the same array instance, if the element
 * is already present in the array.
 */
public static <T> T[] addUnique(T[] array, T element) {
  return addUnique(array, element, true);
}
origin: org.glassfish.grizzly/grizzly-core

/**
 * {@inheritDoc}
 */
@Override
public boolean containsAll(Collection<?> collection) {
  if (collection.isEmpty()) {
    return true;
  }
  final Object[] localArray = array;
  for (Object element : collection) {
    if (ArrayUtils.indexOf(localArray, element) == -1) {
      return false;
    }
  }
  return true;
}
origin: org.glassfish.grizzly/grizzly-http-server-core

private void recalcIndex(final int index) {
  final int idx = index < bufferBounds[0]
      ? 0 
      : ArrayUtils.binarySearch(bufferBounds, 0,
      buffersSize - 1, index + 1);
  
  activeBuffer = buffers[idx];
  upperBound = bufferBounds[idx];
  lowerBound = upperBound - activeBuffer.remaining();
  lastSegmentIndex = idx;
  activeBufferLowerBound = lowerBound - activeBuffer.position();
}
origin: javaee/grizzly

/**
 * Remove element(s) from the set.
 *
 * @param elements the element(s) to remove.
 * @return <tt>true</tt>, if at least one element was found and removed,
 * or <tt>false</tt> otherwise.
 */
public final boolean removeAll(Object... elements) {
  if (elements.length == 0) {
    return false;
  }
  synchronized (sync) {
    if (array == null) {
      return false;
    }
    boolean result = false;
    for (Object element : elements) {
      final T[] oldArray = array;
      array = ArrayUtils.remove(array, element);
      result |= (oldArray != array);
    }
    return result;
  }
}
origin: javaee/grizzly

/**
 * Add unique element to the array.
 * @param <T> type of the array element
 * @param array array
 * @param element element to add
 *
 * @return array, which will contain the new element. Either new array instance, if
 * passed array didn't contain the element, or the same array instance, if the element
 * is already present in the array.
 */
public static <T> T[] addUnique(T[] array, T element) {
  return addUnique(array, element, true);
}
origin: org.mule.glassfish.grizzly/grizzly-framework

/**
 * {@inheritDoc}
 */
@Override
public boolean containsAll(Collection<?> collection) {
  if (collection.isEmpty()) {
    return true;
  }
  final Object[] localArray = array;
  for (Object element : collection) {
    if (ArrayUtils.indexOf(localArray, element) == -1) {
      return false;
    }
  }
  return true;
}
origin: org.glassfish.grizzly/grizzly-websockets-server

private void recalcIndex(final int index) {
  final int idx = index < bufferBounds[0]
      ? 0 
      : ArrayUtils.binarySearch(bufferBounds, 0,
      buffersSize - 1, index + 1);
  
  activeBuffer = buffers[idx];
  upperBound = bufferBounds[idx];
  lowerBound = upperBound - activeBuffer.remaining();
  lastSegmentIndex = idx;
  activeBufferLowerBound = lowerBound - activeBuffer.position();
}
org.glassfish.grizzly.utilsArrayUtils

Javadoc

Set of utility methods to work with Arrays.

Most used methods

  • addUnique
    Add unique element to the array.
  • binarySearch
  • indexOf
    Return the element index in the array.
  • remove
    Removes the element from the array.

Popular in Java

  • Making http requests using okhttp
  • putExtra (Intent)
  • onCreateOptionsMenu (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • Join (org.hibernate.mapping)
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now