Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. /**
  2. * Lisätään taulukkon uusi alkio
  3. * @param alkio lisättävän alkion viite
  4. * @throws TaulukkoTaysiException jos taulukko jo täysi
  5. */
  6. @SuppressWarnings("unchecked")
  7. public void lisaa(TYPE alkio) throws TaulukkoTaysiException {
  8. if(lkm >= alkiot.length) {
  9. TYPE uusi[] = (TYPE[]) new Object[lkm+5];
  10. System.arraycopy(alkiot, 0, uusi, 0, alkiot.length);
  11. alkiot = uusi;
  12. }
  13. alkiot[lkm] = alkio;
  14. lkm++;
  15.  
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement