Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

51
LINES

< > BotCompany Repo | #1012666 // Collection to List Notification Methods (Include) with A instead of E

JavaX fragment (include)

  public boolean equals(Object o) {
      if (this == o)
          return true;
      synchronized (this) {return list.equals(o);}
  }
  public int hashCode() {
      synchronized (this) {return list.hashCode();}
  }

  public A get(int index) {
      synchronized (this) {return list.get(index);}
  }
  public A set(int index, A element) {
    synchronized (this) { beforeChange(); A a = list.set(index, element); change(); ret a; }
  }
  public void add(int index, A element) {
    synchronized (this) { beforeChange(); list.add(index, element);} change();
  }
  public A remove(int index) {
    A e;
    synchronized (this) { beforeChange(); e = list.remove(index); }
    change();
    ret e;
  }

  public int indexOf(Object o) {
      synchronized (this) {return list.indexOf(o);}
  }
  public int lastIndexOf(Object o) {
      synchronized (this) {return list.lastIndexOf(o);}
  }

  public boolean addAll(int index, Collection<? extends A> c) {
    synchronized (this) { beforeChange(); if (!list.addAll(index, c)) false;} change(); true;
  }

  public ListIterator<A> listIterator() {
      return list.listIterator(); // doesn't implement all methods
  }

  public ListIterator<A> listIterator(int index) {
      return list.listIterator(index); // doesn't implement all methods
  }

  /*public void replaceAll(UnaryOperator<A> operator) {
      synchronized (this) {list.replaceAll(operator);}
  }*/
  
  public void sort(Comparator<? super A> c) {
    synchronized (this) { beforeChange(); list.sort(c);} change();
  }

Author comment

Began life as a copy of #1011344

download  show line numbers  debug dex  old transpilations   

Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, wnsclhtenguj

No comments. add comment

Snippet ID: #1012666
Snippet name: Collection to List Notification Methods (Include) with A instead of E
Eternal ID of this version: #1012666/5
Text MD5: 39d3bc081b034419be578201c3b24b2f
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-02-13 18:30:50
Source code size: 1579 bytes / 51 lines
Pitched / IR pitched: No / No
Views / Downloads: 360 / 1207
Version history: 4 change(s)
Referenced in: [show references]