Advertisement
Alex9090

Untitled

Jun 21st, 2018
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.44 KB | None | 0 0
  1. list<Produs> lista = new Produs<>();
  2. lista.add(new Produs());
  3. a) lista.stream().filter(p->p.getFirma().equals("Mag")).
  4.          .sorted(Comparator.comparing(Produs::getPret().reversed()).
  5.          .forEach(System.out::println);
  6. b) lista.stream().map(Produs::getProdus).distinct().forEach();
  7. c) System.out.println(lista.stream().filter(p->p.getPret())>1000).
  8.                     .collcet(Collectors.toList());
  9. d) lista.stream().collect(Collectors.groupingBy(PRodus::getFirma)).
  10.          .forEach((f,listp)->{ System.out.println(f+""),
  11.                     listp.stream().map(Produs::getProdus).
  12.                     .forEach(System.out.println);
  13.         })
  14.  
  15. class Fir extends Thread{
  16.     private String numeFis;
  17.     private String cuv;
  18.     private nrApar;
  19.    
  20.     public void run(){
  21.         Scanner fn = new Scanner(new File(numeFis));
  22.         String line;
  23.         while(fn.hasNextLine()){
  24.             line = fn.nextLine();
  25.                  = line.split();
  26.             for(String aux:v){
  27.                 if(aux.equals(cuv))
  28.                     this.nrApr++;}
  29.     init getnrap(){return nrap;}}
  30. public class Start{
  31.  
  32. public static void main(){
  33. String cuv; Scanner in = new Scanner(System.in);
  34. cuv = in.nextInt();
  35. Fir f1 = new Fir("exp1", cuv);
  36. Fir f2 = new Fir("exp2", cuv);
  37. f1.start();
  38. f1.join();
  39. f2.start();
  40. f2.join();
  41.  
  42. SAU
  43.  
  44. public class Myhread extends Thread{
  45.     private String file;
  46.     private HashMap<String, Double>mp;
  47.     public MyThread(){}
  48.     public void run(){
  49.         BufferedReader br = new BufferedReader(new FileReader(this.file));
  50.         String line;
  51.         String [] words;
  52.         while( (line = br.readLine) != 0) {
  53.             words = line.split(",");
  54.             for(String w:words){
  55.                 if(mp.containsKey(w[1]))
  56.                     mp.put(w[1], Double.parseDouble(w[2])+mpget(w[1]));
  57.                 else mp.put(w[1],Double.parseDouble(w[3]));
  58.     }
  59. public Double getProdValue(String product){return mp.get(prod);}
  60.  
  61. IV
  62. public class Produse extends HTTPServelet {
  63. Connection con = null;
  64. public void init() { con = DriverManager.getConnection(URL);}
  65. public void destroy() {con.close();}
  66. protected obGet(HTTPServeletRequest request, HTTPServeletResponse response) throws..{
  67.         printWriter fout = res.getWriter();
  68.         fout.println("<html>");
  69.         fout.println("<body>");
  70.         String SQL = "SELECT * FROM  Stoc WHERE FIRMA =? AND COD_MAN =?"
  71.         PreparedStatement st = con.prepareStatement(SQL);
  72.         double val = Double.parseDouble(request.getParameter"COD");
  73.         String den = request.getParameter"Nume";
  74.         ResultSet rez = set.ExecuteQuery();
  75.         while(rez.next()){
  76.             fout.println("<h1>"+rez.getString("FIRMA")+rez + "" +
  77.                     +rez.getString(2)+...+</h1>");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement