From Queen Bird, 3 Years ago, written in Plain Text.
Embed
">
A PHP Error was encountered
Severity: Notice
Message: Trying to access array offset on value of type bool
Filename: view/view.php
Line Number: 65
and
Re: Untitled
package task2;
import java.util.ArrayList;
import java.util.List;
public class Test {
public static void main(String[] args) {
// task 2
PasswordMaker PasswordGenerator = PasswordMaker.getInstance();
String password = PasswordGenerator.getPassword("Mihai");
PasswordMaker PasswordGenerator2 = PasswordMaker.getInstance();
String password2 = PasswordGenerator2.getPassword("Alex");
System.out.println(password + " " + password2);
// task 4
ArrayList<Integer> List = new ArrayList<>();
List.add(1);
List.add(2);
List.add(3);
List.add(4);
System.out.println(List);
MyImmutableArray Array = new MyImmutableArray(List);
System.out.println(Array.getArray());
List<Integer> immutableList = Array.getArray();
// Atunci cand rulam programul, la aceasta linie primim eroare
// deoarece lista este immutable si nu putem sa o schimbam
immutableList.add(5);
System.out.println(immutableList);
}
}
package task2;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class MyImmutableArray {
private ArrayList<Integer> immutableArray;
public MyImmutableArray(ArrayList<Integer> immutableArray) {
this.immutableArray = immutableArray;
}
public List<Integer> getArray () {
return Collections.unmodifiableList(immutableArray);
}
}
public MyImmutableArray(ArrayList<Integer> array) {
immutableArray = new ArrayList<Integer>(array.size());
for (Integer integer : array) {
immutableArray.add(Integer.valueOf(integer));
}
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}