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

51
LINES

< > BotCompany Repo | #1011344 // Collection to List Notification Methods (Include)

JavaX fragment (include)

1  
  public boolean equals(Object o) {
2  
      if (this == o)
3  
          return true;
4  
      synchronized (this) {return list.equals(o);}
5  
  }
6  
  public int hashCode() {
7  
      synchronized (this) {return list.hashCode();}
8  
  }
9  
10  
  public E get(int index) {
11  
      synchronized (this) {return list.get(index);}
12  
  }
13  
  public E set(int index, E element) {
14  
      synchronized (this) {return list.set(index, element);}
15  
  }
16  
  public void add(int index, E element) {
17  
      synchronized (this) {list.add(index, element);} change();
18  
  }
19  
  public E remove(int index) {
20  
    E e;
21  
    synchronized (this) { e = list.remove(index); }
22  
    change();
23  
    ret e;
24  
  }
25  
26  
  public int indexOf(Object o) {
27  
      synchronized (this) {return list.indexOf(o);}
28  
  }
29  
  public int lastIndexOf(Object o) {
30  
      synchronized (this) {return list.lastIndexOf(o);}
31  
  }
32  
33  
  public boolean addAll(int index, Collection<? extends E> c) {
34  
      synchronized (this) {if (!list.addAll(index, c)) false;} change(); true;
35  
  }
36  
37  
  public ListIterator<E> listIterator() {
38  
      return list.listIterator(); // doesn't implement all methods
39  
  }
40  
41  
  public ListIterator<E> listIterator(int index) {
42  
      return list.listIterator(index); // doesn't implement all methods
43  
  }
44  
45  
  /*public void replaceAll(UnaryOperator<E> operator) {
46  
      synchronized (this) {list.replaceAll(operator);}
47  
  }*/
48  
  
49  
  public void sort(Comparator<? super E> c) {
50  
      synchronized (this) {list.sort(c);} change();
51  
  }

Author comment

Began life as a copy of #1009406

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1011344
Snippet name: Collection to List Notification Methods (Include)
Eternal ID of this version: #1011344/3
Text MD5: 6ac978716d72f8c8bf112e5d622d911e
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-10-25 21:29:31
Source code size: 1486 bytes / 51 lines
Pitched / IR pitched: No / No
Views / Downloads: 527 / 1050
Version history: 2 change(s)
Referenced in: [show references]