Vector lastElement - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Vector lastElement method.

This code example shows how to use the following methods:isEmpty, lastElement, setSize, size
   */ 
  public synchronized DTMIterator getInstanceOrThrow() 
    throws CloneNotSupportedException 
  { 
    // Check if the pool is empty. 
    if (m_freeStack.isEmpty())
    { 
 
      // Create a new object if so. 
      return (DTMIterator)m_orig.clone();
    } 
    else 
    { 
      // Remove object from end of free pool. 
      DTMIterator result = (DTMIterator)m_freeStack.lastElement();
 
      m_freeStack.setSize(m_freeStack.size() - 1);
 
      return result;
    } 

7
CodeRank
This code example shows how to use the following methods:isEmpty, lastElement, size
   */ 
  public synchronized Object getInstanceIfFree()
  { 
 
    // Check if the pool is empty. 
    if (!freeStack.isEmpty())
    { 
 
      // Remove object from end of free pool. 
      Object result = freeStack.lastElement();
 
      freeStack.setSize(freeStack.size() - 1);
 
      return result;
    } 
 
    return null; 
  } 
 
  /** 
6
CodeRank
This code example shows how to use the following methods:lastElement, removeElementAt, size
	} 
 
	protected IPath popDirectory() { 
        int i = getDirectoryLevel();
        if (i != 0) {
            IPath dir = fDirectoryStack.lastElement();
            fDirectoryStack.removeElementAt(i - 1);
            return dir;
        } 
        return new Path("");    //$NON-NLS-1$
    } 
 
    protected int getDirectoryLevel() { 
        return fDirectoryStack.size();
    } 
 
    public void changeMakeDirectory(String dir, int dirLevel, boolean enterDir) {
        if (enterDir) {
            /* Sometimes make screws up the output, so 
             * "leave" events can't be seen.  Double-check level 
6
CodeRank
This code example shows how to use the following methods:push, isEmpty, lastElement, remove, size
    return ""; 
  } 
 
  protected void kP(String paramString)
  { 
    if (!this.hrs.isEmpty()) {
      String str = (String)this.hrs.lastElement();
      if ((str == null) || (!str.equals(paramString)))
      { 
        if (this.hrs.size() >= 100)
          this.hrs.remove(this.hrs.lastElement());
        this.hrs.push(paramString);
      } 
    } else { 
      this.hrs.push(paramString);
    } 
    this.hrt = this.hrs.listIterator(this.hrs.size());
  } 
} 

6
CodeRank
This code example shows how to use the following methods:isEmpty, pop, lastElement
		fFilterTreeStack.push(node);
	} 
 
	@Override 
	public void endElement(String uri, String localName, String qName) throws SAXException {
		ITmfFilterTreeNode node = fFilterTreeStack.pop();
 
		if (fFilterTreeStack.isEmpty()) {
			fRoot = node;
		} else if (fFilterTreeStack.lastElement() instanceof TmfFilterTreeNode &&
				node instanceof TmfFilterTreeNode) {
			fFilterTreeStack.lastElement().addChild(node);
		} 
 
	} 
 
} 
6
CodeRank
This code example shows how to use the following methods:add, lastElement
    } 
 
    /** Duplicates the top item on the stack */ 
    private void opDup() { 
        log.debug("DUP"); 
        stack.add(Arrays.clone(stack.lastElement()));
    } 
 
    ////////////////////// Interface for writing scripts from scratch //////////////////////////////// 
 
    /** Writes out the given byte buffer to the output stream with the correct opcode prefix */ 
    static void writeBytes(OutputStream os,  byte[] buf) throws IOException {
        if (buf.length < OP_PUSHDATA1) {
            os.write(buf.length);
            os.write(buf);
        } else if (buf.length < 256) {
            os.write(OP_PUSHDATA1);
            os.write(buf.length);
            os.write(buf);
        } else if (buf.length < 65536) {
6
CodeRank
This code example shows how to use the following methods:lastElement, size
			activity = null;
		} 
	} 
 
	public Activity currentActivity() {
		if(stacks.size() > 0 ){
			Activity activity = stacks.lastElement();
			return activity;
		}else{ 
			return null; 
		} 
	} 
 
	public void pushActivity(Activity activity) {
		if (stacks == null) {
			stacks = new Stack<Activity>();
		} 
		stacks.add(activity);
	} 
	 
6
CodeRank
This code example shows how to use the following methods:lastElement, remove
      this.queueVector.remove(object);
   } 
 
   protected synchronized Object removeLast()
   { 
      Object object = this.queueVector.lastElement();
      this.queueVector.remove(object);
      return object;
   } 
} 
6
CodeRank
This code example shows how to use the following methods:isEmpty, lastElement, removeElementAt, size
     * 
     * @return a buffer 
     * @see #putBuffer(byte[]) 
     */ 
    public synchronized byte[] getBuffer() { 
        if (pool.isEmpty())
            return new byte[BUFFER_SIZE];
        byte[] buffer = (byte[]) pool.lastElement();
        pool.removeElementAt(pool.size() - 1);
        return buffer;
    } 
 
    /** 
     * Puts the given buffer into the pool for future use. The size of the 
     * buffer must be <code>BUFFER_SIZE</code>. 
     * 
     * @param buffer the buffer to be put back into the buffer pool 
     * @see #getBuffer() 
     */ 
    public synchronized void putBuffer(byte[] buffer) {
6
CodeRank
This code example shows how to use the following methods:lastElement, removeElement
        commands.addElement(command); 
        command.execute(); 
    } 
 
    public void undoLastCommand() { 
        final Command lastCommand = commands.lastElement(); 
        lastCommand.undo(); 
        commands.removeElement(lastCommand); 
    } 
 
    public String descriptionOfUndo() { 
        final Command lastCommand = commands.lastElement(); 
        return lastCommand.getDescription(); 
    } 
 
    public boolean isEmpty() { 
        return commands.isEmpty(); 
    } 
 
    public String getNameOfUndo() { 
6
CodeRank
lastElement Method Overview
Returns the last component of the vector.
See Code Examples for other Java 8 Vector Methods: