Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
commons-collections4-4.2-sources.jar - Apache Commons Collections
commons-collections4-4.2-sources.jar is the source JAR file for Apache Commons Collections 4.2, which provides additional collection handling functionalities on top of JDK library.
JAR File Size and Download Location:
JAR name: commons-collections4-4.2-sources.jar Target JDK version: 1.7 Dependency: None File size: 708,599 bytes Release date: 08-Jul-2018 Download: Apache Commons Collections
✍: FYIcenter.com
⏎ org/apache/commons/collections4/ArrayStack.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.collections4; import java.util.ArrayList; import java.util.EmptyStackException; /** * An implementation of the {@link java.util.Stack} API that is based on an * <code>ArrayList</code> instead of a <code>Vector</code>, so it is not * synchronized to protect against multi-threaded access. The implementation * is therefore operates faster in environments where you do not need to * worry about multiple thread contention. * <p> * The removal order of an <code>ArrayStack</code> is based on insertion * order: The most recently added element is removed first. The iteration * order is <i>not</i> the same as the removal order. The iterator returns * elements from the bottom up. * <p> * Unlike <code>Stack</code>, <code>ArrayStack</code> accepts null entries. * <p> * <b>Note:</b> From version 4.0 onwards, this class does not implement the * removed {@code Buffer} interface anymore. * * @param <E> the type of elements in this list * @see java.util.Stack * @since 1.0 * @deprecated use {@link java.util.ArrayDeque} instead (available from Java 1.6) */ @Deprecated public class ArrayStack<E> extends ArrayList<E> { /** Ensure serialization compatibility */ private static final long serialVersionUID = 2130079159931574599L; /** * Constructs a new empty <code>ArrayStack</code>. The initial size * is controlled by <code>ArrayList</code> and is currently 10. */ public ArrayStack() { super(); } /** * Constructs a new empty <code>ArrayStack</code> with an initial size. * * @param initialSize the initial size to use * @throws IllegalArgumentException if the specified initial size * is negative */ public ArrayStack(final int initialSize) { super(initialSize); } /** * Return <code>true</code> if this stack is currently empty. * <p> * This method exists for compatibility with <code>java.util.Stack</code>. * New users of this class should use <code>isEmpty</code> instead. * * @return true if the stack is currently empty */ public boolean empty() { return isEmpty(); } /** * Returns the top item off of this stack without removing it. * * @return the top item on the stack * @throws EmptyStackException if the stack is empty */ public E peek() throws EmptyStackException { final int n = size(); if (n <= 0) { throw new EmptyStackException(); } return get(n - 1); } /** * Returns the n'th item down (zero-relative) from the top of this * stack without removing it. * * @param n the number of items down to go * @return the n'th item on the stack, zero relative * @throws EmptyStackException if there are not enough items on the * stack to satisfy this request */ public E peek(final int n) throws EmptyStackException { final int m = (size() - n) - 1; if (m < 0) { throw new EmptyStackException(); } return get(m); } /** * Pops the top item off of this stack and return it. * * @return the top item on the stack * @throws EmptyStackException if the stack is empty */ public E pop() throws EmptyStackException { final int n = size(); if (n <= 0) { throw new EmptyStackException(); } return remove(n - 1); } /** * Pushes a new item onto the top of this stack. The pushed item is also * returned. This is equivalent to calling <code>add</code>. * * @param item the item to be added * @return the item just pushed */ public E push(final E item) { add(item); return item; } /** * Returns the one-based position of the distance from the top that the * specified object exists on this stack, where the top-most element is * considered to be at distance <code>1</code>. If the object is not * present on the stack, return <code>-1</code> instead. The * <code>equals()</code> method is used to compare to the items * in this stack. * * @param object the object to be searched for * @return the 1-based depth into the stack of the object, or -1 if not found */ public int search(final Object object) { int i = size() - 1; // Current index int n = 1; // Current distance while (i >= 0) { final Object current = get(i); if ((object == null && current == null) || (object != null && object.equals(current))) { return n; } i--; n++; } return -1; } }
⏎ org/apache/commons/collections4/ArrayStack.java
Or download all of them as a single archive file:
File name: commons-collections4-4.2-sources.jar File size: 708599 bytes Release date: 2018-07-08 Download
⇒ Download and Install commons-collections4-4.1-bin.zip
⇐ What Is commons-collections4-4.2.jar
2023-03-28, 27658👍, 0💬
Popular Posts:
jlGui is a music player for the Java platform. It is based on Java Sound 1.0 (i.e. JDK 1.3+). It sup...
Swingx is the SwingLabs Swing Component Extensions. JAR File Size and Download Location: File name: ...
How to download and install Apache XMLBeans-2.6.0.zip? If you want to try the XMLBeans Java library,...
What JAR files are required to run sax\Writer.java provided in the Apache Xerces package? 1 JAR file...
How to download and install Apache XMLBeans-2.6.0.zip? If you want to try the XMLBeans Java library,...