├── AtributoColeccion
├── build.xml
├── build
│ └── classes
│ │ ├── .netbeans_automatic_build
│ │ ├── .netbeans_update_resources
│ │ └── atributocoleccion
│ │ ├── Coleccion.class
│ │ └── Main.class
├── manifest.mf
├── nbproject
│ ├── build-impl.xml
│ ├── genfiles.properties
│ ├── private
│ │ ├── private.properties
│ │ └── private.xml
│ ├── project.properties
│ └── project.xml
└── src
│ └── atributocoleccion
│ ├── Coleccion.java
│ └── Main.java
├── Colecciones
├── build.xml
├── build
│ └── classes
│ │ ├── .netbeans_automatic_build
│ │ ├── .netbeans_update_resources
│ │ ├── Curso
│ │ ├── Estudiante$1.class
│ │ ├── Estudiante$2.class
│ │ ├── Estudiante.class
│ │ └── Main.class
│ │ ├── Listas
│ │ └── Listas.class
│ │ ├── Mapas
│ │ ├── Maps.class
│ │ └── Tree.class
│ │ └── Sets
│ │ ├── SetTree.class
│ │ └── Sets.class
├── manifest.mf
├── nbproject
│ ├── build-impl.xml
│ ├── genfiles.properties
│ ├── private
│ │ ├── private.properties
│ │ └── private.xml
│ ├── project.properties
│ └── project.xml
└── src
│ ├── Curso
│ ├── Estudiante.java
│ └── Main.java
│ ├── Listas
│ └── Listas.java
│ ├── Mapas
│ ├── Maps.java
│ └── Tree.java
│ └── Sets
│ ├── SetTree.java
│ └── Sets.java
├── EjemploArrayList
├── build.xml
├── build
│ └── classes
│ │ ├── .netbeans_automatic_build
│ │ ├── .netbeans_update_resources
│ │ ├── entidad
│ │ └── PersonaArrayList.class
│ │ ├── principal
│ │ └── ClaseMainArrayList.class
│ │ └── servicios
│ │ └── PersonaServicioArrayList.class
├── manifest.mf
├── nbproject
│ ├── build-impl.xml
│ ├── genfiles.properties
│ ├── private
│ │ ├── private.properties
│ │ └── private.xml
│ ├── project.properties
│ └── project.xml
└── src
│ ├── entidad
│ └── PersonaArrayList.java
│ ├── principal
│ └── ClaseMainArrayList.java
│ └── servicios
│ └── PersonaServicioArrayList.java
├── EjemploHashMap
├── build.xml
├── build
│ └── classes
│ │ ├── .netbeans_automatic_build
│ │ ├── .netbeans_update_resources
│ │ ├── entidades
│ │ └── PersonaHashMap.class
│ │ ├── principal
│ │ └── ClaseMainHashMap.class
│ │ └── servicios
│ │ └── PersonaServicioHashMap.class
├── manifest.mf
├── nbproject
│ ├── build-impl.xml
│ ├── genfiles.properties
│ ├── private
│ │ ├── private.properties
│ │ └── private.xml
│ ├── project.properties
│ └── project.xml
└── src
│ ├── entidades
│ └── PersonaHashMap.java
│ ├── principal
│ └── ClaseMainHashMap.java
│ └── servicios
│ └── PersonaServicioHashMap.java
├── EjemploHashSet
├── build.xml
├── build
│ └── classes
│ │ ├── .netbeans_automatic_build
│ │ ├── .netbeans_update_resources
│ │ ├── Servicios
│ │ └── PersonaServicioHashSet.class
│ │ ├── entidad
│ │ ├── Persona.rs
│ │ └── PersonaHashSet.class
│ │ └── principal
│ │ └── ClaseMainHashSet.class
├── manifest.mf
├── nbproject
│ ├── build-impl.xml
│ ├── genfiles.properties
│ ├── private
│ │ ├── private.properties
│ │ └── private.xml
│ ├── project.properties
│ └── project.xml
└── src
│ ├── entidad
│ └── PersonaHashSet.java
│ ├── principal
│ └── ClaseMainHashSet.java
│ └── servicios
│ └── PersonaServicioHashSet.java
├── ORDENAR medoto SORT(Colecciones).txt
└── README.md
/AtributoColeccion/build.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Builds, tests, and runs the project AtributoColeccion.
12 |
13 |
73 |
74 |
--------------------------------------------------------------------------------
/AtributoColeccion/build/classes/.netbeans_automatic_build:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EggCooperation/Java-Collecciones/e23dd1f49f265a6c7eaa31e9b7c847f72e36d1f2/AtributoColeccion/build/classes/.netbeans_automatic_build
--------------------------------------------------------------------------------
/AtributoColeccion/build/classes/.netbeans_update_resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EggCooperation/Java-Collecciones/e23dd1f49f265a6c7eaa31e9b7c847f72e36d1f2/AtributoColeccion/build/classes/.netbeans_update_resources
--------------------------------------------------------------------------------
/AtributoColeccion/build/classes/atributocoleccion/Coleccion.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EggCooperation/Java-Collecciones/e23dd1f49f265a6c7eaa31e9b7c847f72e36d1f2/AtributoColeccion/build/classes/atributocoleccion/Coleccion.class
--------------------------------------------------------------------------------
/AtributoColeccion/build/classes/atributocoleccion/Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EggCooperation/Java-Collecciones/e23dd1f49f265a6c7eaa31e9b7c847f72e36d1f2/AtributoColeccion/build/classes/atributocoleccion/Main.class
--------------------------------------------------------------------------------
/AtributoColeccion/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/AtributoColeccion/nbproject/genfiles.properties:
--------------------------------------------------------------------------------
1 | build.xml.data.CRC32=341e7748
2 | build.xml.script.CRC32=34e98f1a
3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48
4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
6 | nbproject/build-impl.xml.data.CRC32=341e7748
7 | nbproject/build-impl.xml.script.CRC32=d8e8d557
8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48
9 |
--------------------------------------------------------------------------------
/AtributoColeccion/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\AsteriX\\AppData\\Roaming\\NetBeans\\8.2\\build.properties
3 |
--------------------------------------------------------------------------------
/AtributoColeccion/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/AtributoColeccion/nbproject/project.properties:
--------------------------------------------------------------------------------
1 | annotation.processing.enabled=true
2 | annotation.processing.enabled.in.editor=false
3 | annotation.processing.processor.options=
4 | annotation.processing.processors.list=
5 | annotation.processing.run.all.processors=true
6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
7 | build.classes.dir=${build.dir}/classes
8 | build.classes.excludes=**/*.java,**/*.form
9 | # This directory is removed when the project is cleaned:
10 | build.dir=build
11 | build.generated.dir=${build.dir}/generated
12 | build.generated.sources.dir=${build.dir}/generated-sources
13 | # Only compile against the classpath explicitly listed here:
14 | build.sysclasspath=ignore
15 | build.test.classes.dir=${build.dir}/test/classes
16 | build.test.results.dir=${build.dir}/test/results
17 | # Uncomment to specify the preferred debugger connection transport:
18 | #debug.transport=dt_socket
19 | debug.classpath=\
20 | ${run.classpath}
21 | debug.test.classpath=\
22 | ${run.test.classpath}
23 | # Files in build.classes.dir which should be excluded from distribution jar
24 | dist.archive.excludes=
25 | # This directory is removed when the project is cleaned:
26 | dist.dir=dist
27 | dist.jar=${dist.dir}/AtributoColeccion.jar
28 | dist.javadoc.dir=${dist.dir}/javadoc
29 | excludes=
30 | includes=**
31 | jar.compress=false
32 | javac.classpath=
33 | # Space-separated list of extra javac options
34 | javac.compilerargs=
35 | javac.deprecation=false
36 | javac.external.vm=true
37 | javac.processorpath=\
38 | ${javac.classpath}
39 | javac.source=1.8
40 | javac.target=1.8
41 | javac.test.classpath=\
42 | ${javac.classpath}:\
43 | ${build.classes.dir}
44 | javac.test.processorpath=\
45 | ${javac.test.classpath}
46 | javadoc.additionalparam=
47 | javadoc.author=false
48 | javadoc.encoding=${source.encoding}
49 | javadoc.noindex=false
50 | javadoc.nonavbar=false
51 | javadoc.notree=false
52 | javadoc.private=false
53 | javadoc.splitindex=true
54 | javadoc.use=true
55 | javadoc.version=false
56 | javadoc.windowtitle=
57 | main.class=atributocoleccion.Main
58 | manifest.file=manifest.mf
59 | meta.inf.dir=${src.dir}/META-INF
60 | mkdist.disabled=false
61 | platform.active=default_platform
62 | run.classpath=\
63 | ${javac.classpath}:\
64 | ${build.classes.dir}
65 | # Space-separated list of JVM arguments used when running the project.
66 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
67 | # To set system properties for unit tests define test-sys-prop.name=value:
68 | run.jvmargs=
69 | run.test.classpath=\
70 | ${javac.test.classpath}:\
71 | ${build.test.classes.dir}
72 | source.encoding=UTF-8
73 | src.dir=src
74 | test.src.dir=test
75 |
--------------------------------------------------------------------------------
/AtributoColeccion/nbproject/project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.netbeans.modules.java.j2seproject
4 |
5 |
6 | AtributoColeccion
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/AtributoColeccion/src/atributocoleccion/Coleccion.java:
--------------------------------------------------------------------------------
1 | package atributocoleccion;
2 |
3 | import java.util.ArrayList;
4 | import java.util.HashMap;
5 | import java.util.HashSet;
6 |
7 |
8 | public class Coleccion {
9 |
10 | private ArrayList libros;
11 | private HashSet numeros; // Puede ser tanto un HashSet como un TreeSet
12 | private HashMap alumnos; // Puede ser tanto un hashMap como un TreeMap
13 |
14 | public Coleccion(ArrayList libros, HashSet numeros, HashMap alumnos) {
15 | this.libros = libros;
16 | this.numeros = numeros;
17 | this.alumnos = alumnos;
18 | }
19 |
20 | public Coleccion() {
21 |
22 | // Se inicializan las colecciones para que no esten en null, si no vacios.
23 | libros = new ArrayList();
24 | numeros = new HashSet();
25 | alumnos = new HashMap();
26 | }
27 |
28 | public ArrayList getLibros() {
29 | return libros;
30 | }
31 |
32 | public void setLibros(ArrayList libros) {
33 | this.libros = libros;
34 | }
35 |
36 | public HashSet getNumeros() {
37 | return numeros;
38 | }
39 |
40 | public void setNumeros(HashSet numeros) {
41 | this.numeros = numeros;
42 | }
43 |
44 | public HashMap getAlumnos() {
45 | return alumnos;
46 | }
47 |
48 | public void setAlumnos(HashMap alumnos) {
49 | this.alumnos = alumnos;
50 | }
51 |
52 | public void recorrerColecciones(){
53 | for (String libro : libros) {
54 | System.out.println(libro);
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/AtributoColeccion/src/atributocoleccion/Main.java:
--------------------------------------------------------------------------------
1 | package atributocoleccion;
2 |
3 | import java.util.ArrayList;
4 | import java.util.HashMap;
5 | import java.util.HashSet;
6 |
7 | public class Main {
8 |
9 | public static void main(String[] args) {
10 |
11 | Coleccion c1 = new Coleccion();
12 |
13 | ArrayList libros = new ArrayList();
14 |
15 | libros.add("La Odisea");
16 |
17 | c1.setLibros(libros); // Se guarda la lista
18 |
19 | // Conjuntos
20 |
21 | HashSet numeros = new HashSet();
22 |
23 | numeros.add(10);
24 | numeros.add(86);
25 | // Fua el Diego
26 |
27 | c1.setNumeros(numeros); // Se guarda el conjunto
28 |
29 | // Mapas
30 |
31 | HashMap alumnos = new HashMap();
32 |
33 | alumnos.put(40234123, "Nacho");
34 |
35 | c1.setAlumnos(alumnos); // Se guarda el mapa
36 |
37 | for (String libro : c1.getLibros()) {
38 | System.out.println(libro); // Mostrar el conjunto usando el get
39 | }
40 |
41 | for (Integer numero : c1.getNumeros()) {
42 | System.out.println(numero); // Mostrar el conjunto usando el get
43 | }
44 |
45 | c1.recorrerColecciones(); // Mostramos la lista a traves del objeto
46 |
47 |
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/Colecciones/build.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Builds, tests, and runs the project Colecciones.
12 |
13 |
73 |
74 |
--------------------------------------------------------------------------------
/Colecciones/build/classes/.netbeans_automatic_build:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EggCooperation/Java-Collecciones/e23dd1f49f265a6c7eaa31e9b7c847f72e36d1f2/Colecciones/build/classes/.netbeans_automatic_build
--------------------------------------------------------------------------------
/Colecciones/build/classes/.netbeans_update_resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EggCooperation/Java-Collecciones/e23dd1f49f265a6c7eaa31e9b7c847f72e36d1f2/Colecciones/build/classes/.netbeans_update_resources
--------------------------------------------------------------------------------
/Colecciones/build/classes/Curso/Estudiante$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EggCooperation/Java-Collecciones/e23dd1f49f265a6c7eaa31e9b7c847f72e36d1f2/Colecciones/build/classes/Curso/Estudiante$1.class
--------------------------------------------------------------------------------
/Colecciones/build/classes/Curso/Estudiante$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EggCooperation/Java-Collecciones/e23dd1f49f265a6c7eaa31e9b7c847f72e36d1f2/Colecciones/build/classes/Curso/Estudiante$2.class
--------------------------------------------------------------------------------
/Colecciones/build/classes/Curso/Estudiante.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EggCooperation/Java-Collecciones/e23dd1f49f265a6c7eaa31e9b7c847f72e36d1f2/Colecciones/build/classes/Curso/Estudiante.class
--------------------------------------------------------------------------------
/Colecciones/build/classes/Curso/Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EggCooperation/Java-Collecciones/e23dd1f49f265a6c7eaa31e9b7c847f72e36d1f2/Colecciones/build/classes/Curso/Main.class
--------------------------------------------------------------------------------
/Colecciones/build/classes/Listas/Listas.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EggCooperation/Java-Collecciones/e23dd1f49f265a6c7eaa31e9b7c847f72e36d1f2/Colecciones/build/classes/Listas/Listas.class
--------------------------------------------------------------------------------
/Colecciones/build/classes/Mapas/Maps.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EggCooperation/Java-Collecciones/e23dd1f49f265a6c7eaa31e9b7c847f72e36d1f2/Colecciones/build/classes/Mapas/Maps.class
--------------------------------------------------------------------------------
/Colecciones/build/classes/Mapas/Tree.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EggCooperation/Java-Collecciones/e23dd1f49f265a6c7eaa31e9b7c847f72e36d1f2/Colecciones/build/classes/Mapas/Tree.class
--------------------------------------------------------------------------------
/Colecciones/build/classes/Sets/SetTree.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EggCooperation/Java-Collecciones/e23dd1f49f265a6c7eaa31e9b7c847f72e36d1f2/Colecciones/build/classes/Sets/SetTree.class
--------------------------------------------------------------------------------
/Colecciones/build/classes/Sets/Sets.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EggCooperation/Java-Collecciones/e23dd1f49f265a6c7eaa31e9b7c847f72e36d1f2/Colecciones/build/classes/Sets/Sets.class
--------------------------------------------------------------------------------
/Colecciones/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/Colecciones/nbproject/build-impl.xml:
--------------------------------------------------------------------------------
1 |
2 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 | Must set src.dir
234 | Must set test.src.dir
235 | Must set build.dir
236 | Must set dist.dir
237 | Must set build.classes.dir
238 | Must set dist.javadoc.dir
239 | Must set build.test.classes.dir
240 | Must set build.test.results.dir
241 | Must set build.classes.excludes
242 | Must set dist.jar
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
343 | Must set javac.includes
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 |
372 |
373 |
374 |
375 |
376 |
377 |
378 |
379 |
380 |
381 |
382 |
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 |
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 |
431 |
432 |
433 |
434 |
435 |
436 |
437 |
438 |
439 |
440 |
441 |
442 |
443 |
444 |
445 |
446 |
447 |
448 |
449 |
450 |
451 |
452 |
453 |
454 |
455 |
456 |
457 |
458 |
459 |
460 |
461 |
462 |
463 |
464 |
465 |
466 |
467 |
468 |
469 |
470 |
471 |
472 | No tests executed.
473 |
474 |
475 |
476 |
477 |
478 |
479 |
480 |
481 |
482 |
483 |
484 |
485 |
486 |
487 |
488 |
489 |
490 |
491 |
492 |
493 |
494 |
495 |
496 |
497 |
498 |
499 |
500 |
501 |
502 |
503 |
504 |
505 |
506 |
507 |
508 |
509 |
510 |
511 |
512 |
513 |
514 |
515 |
516 |
517 |
518 |
519 |
520 |
521 |
522 |
523 |
524 |
525 |
526 |
527 |
528 |
529 |
530 |
531 |
532 |
533 |
534 |
535 |
536 |
537 |
538 |
539 |
540 |
541 |
542 |
543 |
544 |
545 |
546 |
547 |
548 |
549 |
550 |
551 |
552 |
553 |
554 |
555 |
556 |
557 |
558 |
559 |
560 |
561 |
562 |
563 |
564 |
565 |
566 |
567 |
568 |
569 |
570 |
571 |
572 |
573 |
574 |
575 |
576 |
577 |
578 |
579 |
580 |
581 |
582 |
583 |
584 |
585 |
586 |
587 |
588 |
589 |
590 |
591 |
592 |
593 |
594 |
595 |
596 |
597 |
598 |
599 |
600 |
601 |
602 |
603 |
604 |
605 |
606 |
607 |
608 |
609 |
610 |
611 |
612 |
613 |
614 |
615 |
616 |
617 |
618 |
619 |
620 |
621 |
622 |
623 |
624 |
625 |
626 |
627 |
628 |
629 |
630 |
631 |
632 |
633 |
634 |
635 |
636 |
637 |
638 |
639 |
640 |
641 |
642 |
643 |
644 |
645 |
646 |
647 |
648 |
649 |
650 |
651 |
652 |
653 |
654 |
655 |
656 |
657 |
658 |
659 |
660 |
661 |
662 |
663 |
664 |
665 |
666 |
667 |
668 |
669 |
670 |
671 |
672 |
673 |
674 |
675 |
676 |
677 |
680 |
681 |
682 |
683 |
684 |
685 |
686 |
687 |
688 |
689 |
690 |
691 |
692 |
693 |
694 |
695 |
696 |
697 |
698 |
699 |
700 |
701 |
702 |
703 |
704 |
705 |
706 |
707 |
708 |
709 |
710 |
711 |
712 |
713 |
714 |
715 |
716 |
717 |
718 |
719 |
720 |
721 |
722 | Must set JVM to use for profiling in profiler.info.jvm
723 | Must set profiler agent JVM arguments in profiler.info.jvmargs.agent
724 |
725 |
728 |
729 |
730 |
731 |
732 |
733 |
734 |
735 |
736 |
737 |
738 |
739 |
740 |
741 |
742 |
743 |
744 |
745 |
746 |
747 |
748 |
749 |
750 |
751 |
752 |
753 |
754 |
755 |
756 |
757 |
758 |
759 |
760 |
761 |
762 |
763 |
764 |
765 |
766 |
767 |
768 |
769 |
770 |
771 |
772 |
773 |
774 |
775 |
776 |
777 |
778 |
779 |
780 |
781 |
782 |
783 |
784 |
785 |
786 |
787 |
788 |
789 |
790 |
791 |
792 |
793 |
794 |
795 |
796 |
797 |
798 |
799 |
800 |
801 |
802 |
803 |
804 |
805 |
806 |
807 |
808 |
809 |
810 |
811 |
812 |
813 |
814 |
815 |
816 |
817 |
818 |
819 |
820 |
821 |
822 |
823 |
824 |
825 |
826 |
827 |
828 |
829 |
830 |
831 |
832 |
833 |
834 |
835 |
836 |
837 |
838 |
839 |
840 |
841 |
842 |
843 |
844 |
845 |
846 |
847 |
848 |
849 |
850 |
851 |
852 |
853 |
854 |
855 |
856 |
857 |
858 |
859 |
860 |
861 |
862 |
863 |
864 |
865 |
866 |
867 |
868 |
869 |
870 |
871 |
872 |
873 |
874 |
875 |
876 |
877 |
878 |
879 |
880 |
881 |
882 |
883 |
884 |
885 |
886 |
891 |
892 |
893 |
894 |
895 |
896 |
897 |
898 |
899 |
900 |
901 |
902 |
903 |
904 |
905 |
906 |
907 |
908 |
909 |
910 |
911 |
912 |
913 |
914 |
915 |
916 |
917 |
918 |
919 |
920 |
921 |
922 |
923 |
924 |
925 |
926 |
927 |
928 |
929 |
930 |
931 |
932 |
933 |
934 |
935 |
936 |
937 |
938 |
939 |
940 |
941 |
942 |
943 |
944 |
945 |
946 |
947 |
948 |
949 |
950 |
951 | Must select some files in the IDE or set javac.includes
952 |
953 |
954 |
955 |
956 |
957 |
958 |
959 |
960 |
965 |
966 |
967 |
968 |
969 |
970 |
971 |
972 |
973 |
974 |
975 |
976 |
977 |
978 |
979 |
980 |
981 |
982 |
983 |
984 |
985 |
986 |
987 |
988 |
989 |
990 |
991 |
992 |
993 |
994 |
995 |
996 |
997 |
998 |
999 |
1000 |
1001 | To run this application from the command line without Ant, try:
1002 |
1003 | java -jar "${dist.jar.resolved}"
1004 |
1005 |
1006 |
1007 |
1008 |
1009 |
1010 |
1011 |
1012 |
1013 |
1014 |
1015 |
1016 |
1017 |
1018 |
1019 |
1020 |
1021 |
1022 |
1023 |
1024 |
1025 |
1026 |
1027 |
1028 |
1029 |
1030 |
1031 |
1032 |
1033 |
1034 |
1039 |
1040 |
1041 |
1042 |
1043 |
1044 |
1045 |
1046 |
1047 |
1048 |
1049 |
1050 | Must select one file in the IDE or set run.class
1051 |
1052 |
1053 |
1054 | Must select one file in the IDE or set run.class
1055 |
1056 |
1057 |
1062 |
1063 |
1064 |
1065 |
1066 |
1067 |
1068 |
1069 |
1070 |
1071 |
1072 |
1073 |
1074 |
1075 |
1076 |
1077 |
1078 |
1079 |
1080 |
1081 | Must select one file in the IDE or set debug.class
1082 |
1083 |
1084 |
1085 |
1086 | Must select one file in the IDE or set debug.class
1087 |
1088 |
1089 |
1090 |
1091 | Must set fix.includes
1092 |
1093 |
1094 |
1095 |
1096 |
1097 |
1098 |
1103 |
1106 |
1107 | This target only works when run from inside the NetBeans IDE.
1108 |
1109 |
1110 |
1111 |
1112 |
1113 |
1114 |
1115 |
1116 | Must select one file in the IDE or set profile.class
1117 | This target only works when run from inside the NetBeans IDE.
1118 |
1119 |
1120 |
1121 |
1122 |
1123 |
1124 |
1125 |
1126 | This target only works when run from inside the NetBeans IDE.
1127 |
1128 |
1129 |
1130 |
1131 |
1132 |
1133 |
1134 |
1135 |
1136 |
1137 |
1138 |
1139 | This target only works when run from inside the NetBeans IDE.
1140 |
1141 |
1142 |
1143 |
1144 |
1145 |
1146 |
1147 |
1148 |
1149 |
1150 |
1151 |
1152 |
1153 |
1154 |
1155 |
1156 |
1157 |
1158 |
1159 |
1160 |
1161 |
1164 |
1165 |
1166 |
1167 |
1168 |
1169 |
1170 |
1171 |
1172 |
1173 |
1174 |
1175 |
1176 |
1177 | Must select one file in the IDE or set run.class
1178 |
1179 |
1180 |
1181 |
1182 |
1183 | Must select some files in the IDE or set test.includes
1184 |
1185 |
1186 |
1187 |
1188 | Must select one file in the IDE or set run.class
1189 |
1190 |
1191 |
1192 |
1193 | Must select one file in the IDE or set applet.url
1194 |
1195 |
1196 |
1197 |
1202 |
1203 |
1204 |
1205 |
1206 |
1207 |
1208 |
1209 |
1210 |
1211 |
1212 |
1213 |
1214 |
1215 |
1216 |
1217 |
1218 |
1219 |
1220 |
1221 |
1222 |
1223 |
1224 |
1225 |
1226 |
1227 |
1228 |
1229 |
1230 |
1231 |
1232 |
1233 |
1234 |
1235 |
1236 |
1237 |
1238 |
1239 |
1240 |
1241 |
1246 |
1247 |
1248 |
1249 |
1250 |
1251 |
1252 |
1253 |
1254 |
1255 |
1256 |
1257 |
1258 |
1259 |
1260 |
1261 |
1262 |
1263 |
1264 |
1265 |
1266 |
1267 |
1268 |
1269 |
1270 |
1271 |
1272 | Must select some files in the IDE or set javac.includes
1273 |
1274 |
1275 |
1276 |
1277 |
1278 |
1279 |
1280 |
1281 |
1282 |
1283 |
1284 |
1289 |
1290 |
1291 |
1292 |
1293 |
1294 |
1295 |
1296 | Some tests failed; see details above.
1297 |
1298 |
1299 |
1300 |
1301 |
1302 |
1303 |
1304 |
1305 | Must select some files in the IDE or set test.includes
1306 |
1307 |
1308 |
1309 | Some tests failed; see details above.
1310 |
1311 |
1312 |
1313 | Must select some files in the IDE or set test.class
1314 | Must select some method in the IDE or set test.method
1315 |
1316 |
1317 |
1318 | Some tests failed; see details above.
1319 |
1320 |
1321 |
1326 |
1327 | Must select one file in the IDE or set test.class
1328 |
1329 |
1330 |
1331 | Must select one file in the IDE or set test.class
1332 | Must select some method in the IDE or set test.method
1333 |
1334 |
1335 |
1336 |
1337 |
1338 |
1339 |
1340 |
1341 |
1342 |
1343 |
1344 |
1349 |
1350 | Must select one file in the IDE or set applet.url
1351 |
1352 |
1353 |
1354 |
1355 |
1356 |
1357 |
1362 |
1363 | Must select one file in the IDE or set applet.url
1364 |
1365 |
1366 |
1367 |
1368 |
1369 |
1370 |
1371 |
1376 |
1377 |
1378 |
1379 |
1380 |
1381 |
1382 |
1383 |
1384 |
1385 |
1386 |
1387 |
1388 |
1389 |
1390 |
1391 |
1392 |
1393 |
1394 |
1395 |
1396 |
1397 |
1398 |
1399 |
1400 |
1401 |
1402 |
1403 |
1404 |
1405 |
1406 |
1407 |
1408 |
1409 |
1410 |
1411 |
1412 |
1413 |
1414 |
1415 |
1416 |
1417 |
1418 |
1419 |
1420 |
1421 |
--------------------------------------------------------------------------------
/Colecciones/nbproject/genfiles.properties:
--------------------------------------------------------------------------------
1 | build.xml.data.CRC32=d3c4684c
2 | build.xml.script.CRC32=7d9d92cc
3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48
4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
6 | nbproject/build-impl.xml.data.CRC32=d3c4684c
7 | nbproject/build-impl.xml.script.CRC32=c0f8ac18
8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48
9 |
--------------------------------------------------------------------------------
/Colecciones/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\AsteriX\\AppData\\Roaming\\NetBeans\\8.2\\build.properties
3 |
--------------------------------------------------------------------------------
/Colecciones/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Colecciones/nbproject/project.properties:
--------------------------------------------------------------------------------
1 | annotation.processing.enabled=true
2 | annotation.processing.enabled.in.editor=false
3 | annotation.processing.processor.options=
4 | annotation.processing.processors.list=
5 | annotation.processing.run.all.processors=true
6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
7 | build.classes.dir=${build.dir}/classes
8 | build.classes.excludes=**/*.java,**/*.form
9 | # This directory is removed when the project is cleaned:
10 | build.dir=build
11 | build.generated.dir=${build.dir}/generated
12 | build.generated.sources.dir=${build.dir}/generated-sources
13 | # Only compile against the classpath explicitly listed here:
14 | build.sysclasspath=ignore
15 | build.test.classes.dir=${build.dir}/test/classes
16 | build.test.results.dir=${build.dir}/test/results
17 | # Uncomment to specify the preferred debugger connection transport:
18 | #debug.transport=dt_socket
19 | debug.classpath=\
20 | ${run.classpath}
21 | debug.test.classpath=\
22 | ${run.test.classpath}
23 | # Files in build.classes.dir which should be excluded from distribution jar
24 | dist.archive.excludes=
25 | # This directory is removed when the project is cleaned:
26 | dist.dir=dist
27 | dist.jar=${dist.dir}/Colecciones.jar
28 | dist.javadoc.dir=${dist.dir}/javadoc
29 | excludes=
30 | includes=**
31 | jar.compress=false
32 | javac.classpath=
33 | # Space-separated list of extra javac options
34 | javac.compilerargs=
35 | javac.deprecation=false
36 | javac.external.vm=true
37 | javac.processorpath=\
38 | ${javac.classpath}
39 | javac.source=1.8
40 | javac.target=1.8
41 | javac.test.classpath=\
42 | ${javac.classpath}:\
43 | ${build.classes.dir}
44 | javac.test.processorpath=\
45 | ${javac.test.classpath}
46 | javadoc.additionalparam=
47 | javadoc.author=false
48 | javadoc.encoding=${source.encoding}
49 | javadoc.noindex=false
50 | javadoc.nonavbar=false
51 | javadoc.notree=false
52 | javadoc.private=false
53 | javadoc.splitindex=true
54 | javadoc.use=true
55 | javadoc.version=false
56 | javadoc.windowtitle=
57 | main.class=collections.Collections
58 | manifest.file=manifest.mf
59 | meta.inf.dir=${src.dir}/META-INF
60 | mkdist.disabled=false
61 | platform.active=default_platform
62 | run.classpath=\
63 | ${javac.classpath}:\
64 | ${build.classes.dir}
65 | # Space-separated list of JVM arguments used when running the project.
66 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
67 | # To set system properties for unit tests define test-sys-prop.name=value:
68 | run.jvmargs=
69 | run.test.classpath=\
70 | ${javac.test.classpath}:\
71 | ${build.test.classes.dir}
72 | source.encoding=UTF-8
73 | src.dir=src
74 | test.src.dir=test
75 |
--------------------------------------------------------------------------------
/Colecciones/nbproject/project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.netbeans.modules.java.j2seproject
4 |
5 |
6 | Colecciones
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Colecciones/src/Curso/Estudiante.java:
--------------------------------------------------------------------------------
1 | package Curso;
2 |
3 | import java.util.Comparator;
4 |
5 | public class Estudiante {
6 |
7 | private Integer documento;
8 | private String nombre;
9 | private Integer nota1;
10 | private Integer nota2;
11 |
12 | public Integer getDocumento() {
13 | return documento;
14 | }
15 |
16 | public void setDocumento(Integer documento) {
17 | this.documento = documento;
18 | }
19 |
20 | public String getNombre() {
21 | return nombre;
22 | }
23 |
24 | public void setNombre(String nombre) {
25 | this.nombre = nombre;
26 | }
27 |
28 | public Integer getNota1() {
29 | return nota1;
30 | }
31 |
32 | public void setNota1(Integer nota1) {
33 | this.nota1 = nota1;
34 | }
35 |
36 | public Integer getNota2() {
37 | return nota2;
38 | }
39 |
40 | public void setNota2(Integer nota2) {
41 | this.nota2 = nota2;
42 | }
43 |
44 | public int notaFinal(){
45 | int notaFinal;
46 | notaFinal = (nota1 + nota2) / 2;
47 | return notaFinal;
48 | }
49 |
50 |
51 | public static Comparator compararDocumentosAscendente = new Comparator() { // Creamos un objeto comparator
52 | @Override // Usamos el override para traer un metodo de otra clase y poder usarlo
53 | public int compare(Estudiante e1, Estudiante e2) { // Le pasamos dos objetos a comparar
54 | return e1.getDocumento().compareTo(e2.getDocumento()); // Los comparamos usando el get y el compareTo
55 | }
56 | };
57 |
58 | public static Comparator compararNombresAscendente = new Comparator() { // Creamos un objeto comparator
59 | @Override // Usamos el override para traer un metodo de otra clase y poder usarlo
60 | public int compare(Estudiante e1, Estudiante e2) { // Le pasamos dos objetos a comparar
61 | return e1.getNombre().compareTo(e2.getNombre()); // Los comparamos usando el get y el compareTo
62 | }
63 | };
64 |
65 | @Override
66 | public String toString() {
67 | return "Documento: " + documento + ", nombre: " + nombre + ", nota1: " + nota1 + ", nota2: " + nota2 ;
68 | }
69 |
70 | }
71 |
--------------------------------------------------------------------------------
/Colecciones/src/Curso/Main.java:
--------------------------------------------------------------------------------
1 | package Curso;
2 |
3 | import java.util.ArrayList;
4 | import java.util.Collections;
5 | import java.util.Iterator;
6 | import java.util.Scanner;
7 |
8 | public class Main {
9 |
10 | public static void main(String[] args) {
11 |
12 | Scanner scan = new Scanner(System.in).useDelimiter("\n");
13 |
14 | ArrayList estudiantes = new ArrayList(); // Creamos una lista de tipo Estudiante
15 |
16 | String respuesta = "";
17 |
18 | do {
19 |
20 | Estudiante e1 = new Estudiante(); // Creamos un objeto en cada vuelta para meterlo a nuestra lista
21 |
22 | System.out.println("Ingrese el documento del estudiante"); // Pedimos los datos del objeto
23 | int documento = scan.nextInt();
24 |
25 | System.out.println("Ingrese el nombre del estudiante");
26 | String nombre = scan.next();
27 |
28 | System.out.println("Ingrese la nota 1");
29 | int nota1 = scan.nextInt();
30 |
31 | System.out.println("Ingrese la nota 2");
32 | int nota2 = scan.nextInt();
33 |
34 | e1.setDocumento(documento); // Seteamos el documento
35 | e1.setNombre(nombre); // Seteamos el nombre
36 | e1.setNota1(nota1);
37 | e1.setNota2(nota2);
38 |
39 | estudiantes.add(e1); // Agregamos el objeto llenado a la lista
40 |
41 | System.out.println("Quiere ingresar otro alumno ?"); // Y preguntamos si quiere ingresar otro alumno
42 | respuesta = scan.next();
43 |
44 | } while (respuesta.equalsIgnoreCase("si"));
45 |
46 | for (Estudiante estudiante : estudiantes) { // Aca los mostramos en un for each
47 |
48 | System.out.println(estudiante);
49 |
50 | }
51 |
52 |
53 |
54 | estudiantes.sort(Estudiante.compararDocumentosAscendente); // Los ordenamos por el documento mediante un comparator
55 |
56 | for (Estudiante estudiante : estudiantes) { // Aca los mostramos ordenados en un for each
57 |
58 | System.out.println(estudiante);
59 |
60 | }
61 |
62 | // Calcular la nota de final de un estudiante
63 |
64 | // Preguntamos el alumno que queremos saber su nota final
65 | System.out.println("Que estudiante quiere calcular su nota final? ");
66 | String nombreAlumno = scan.next();
67 |
68 | for (Estudiante estudiante : estudiantes) { // Recorremos la lista
69 |
70 | // Validamos si está el alumno que queremos calcular la nota final
71 | if (estudiante.getNombre().equalsIgnoreCase(nombreAlumno)) {
72 |
73 | // Usamos el objeto estudiante creado en el for each para llamar el metodo para calcular la nota final
74 | System.out.println("La nota final de "
75 | + nombreAlumno + " es " + estudiante.notaFinal());
76 | }
77 |
78 | }
79 |
80 | Iterator it = estudiantes.iterator();
81 |
82 | boolean eliminado = false; // Usamos el booleano para mostrar si el alumno se elimino o no
83 |
84 | System.out.println("Que estudiante quiere eliminar ? ");
85 | String nombre = scan.next();
86 |
87 | while (it.hasNext()) {
88 |
89 | if (it.next().getNombre().equalsIgnoreCase(nombre)) {
90 | it.remove();
91 | eliminado = true; // Cuando se elimina pasamos el booleano a true
92 | }
93 |
94 | }
95 |
96 | if (eliminado) {
97 |
98 | for (Estudiante estudiante : estudiantes) { // Aca los mostramos en un for each
99 |
100 | System.out.println(estudiante);
101 |
102 | }
103 |
104 | } else {
105 |
106 | System.out.println("El alumno a eliminar no se encuentra en la nomina");
107 |
108 | }
109 |
110 | }
111 |
112 | }
113 |
--------------------------------------------------------------------------------
/Colecciones/src/Listas/Listas.java:
--------------------------------------------------------------------------------
1 | package Listas;
2 |
3 |
4 | import java.util.ArrayList;
5 | import java.util.Collections;
6 | import java.util.Iterator;
7 | import java.util.Scanner;
8 |
9 | public class Listas {
10 |
11 | public static void main(String[] args) {
12 |
13 | Scanner leer = new Scanner(System.in).useDelimiter("\n");
14 |
15 | ArrayList lista = new ArrayList(); // Creamos una lista de Strings
16 |
17 | String palabra;
18 | String respuesta = "";
19 |
20 | do {
21 | System.out.println("Ingrese una palabra");
22 | palabra = leer.next();
23 |
24 | lista.add(palabra);
25 |
26 | System.out.println("Quiere ingresar otra palabra ?");
27 | respuesta = leer.next();
28 |
29 | } while (respuesta.equalsIgnoreCase("Si"));
30 |
31 | System.out.println("===================================");
32 | System.out.println("Recorremos la lista con un for each");
33 |
34 | for (String cadena : lista) {
35 |
36 | System.out.println(cadena);
37 | }
38 |
39 | System.out.println("===================================");
40 | System.out.println("Recorremos la lista con un iterator");
41 |
42 | Iterator it = lista.iterator();
43 |
44 | while (it.hasNext()) {
45 |
46 | System.out.println(it.next());
47 |
48 | }
49 |
50 | System.out.println("===================================");
51 | System.out.println("Usamos el iterator para remover un elemento porque con el for each falla");
52 |
53 | Iterator it2 = lista.iterator();
54 |
55 | while (it2.hasNext()) {
56 |
57 | if (it2.next().equals("Hola")) { // Borramos si hay alguna palabra que se hola
58 |
59 | it2.remove();
60 |
61 | }
62 | }
63 |
64 | System.out.println("===================================");
65 | System.out.println("Mostramos la lista sin el elemento borrado");
66 |
67 | for (String string : lista) {
68 |
69 | System.out.println(string);
70 |
71 | }
72 |
73 | System.out.println("===================================");
74 | System.out.println("La lista es de tamaño: " + lista.size());
75 |
76 | System.out.println("===================================");
77 | System.out.println("Eliminamos un elemento mediante el indice");
78 |
79 | lista.remove(1); // Removemos un elemento con su indice
80 |
81 | System.out.println("===================================");
82 | System.out.println("Mostramos la lista sin el elemento borrado");
83 |
84 | for (String string : lista) {
85 |
86 | System.out.println(string);
87 |
88 | }
89 |
90 | System.out.println("===================================");
91 | System.out.println("Ordenamos la lista de manera ascendente");
92 |
93 | Collections.sort(lista);
94 |
95 | System.out.println("===================================");
96 | System.out.println("Mostramos la lista ordenada");
97 |
98 | for (String string : lista) {
99 |
100 | System.out.println(string);
101 |
102 | }
103 |
104 | System.out.println("===================================");
105 | System.out.println("Ordenamos la lista de manera descendente");
106 |
107 | Collections.sort(lista, Collections.reverseOrder());
108 |
109 | System.out.println("===================================");
110 | System.out.println("Mostramos la lista ordenada");
111 |
112 | for (String string : lista) {
113 |
114 | System.out.println(string);
115 |
116 | }
117 |
118 | // System.out.println("===================================");
119 | // System.out.println("Nos muestra en que indice se encuentra la palabra hola");
120 | //
121 | // System.out.println(lista.indexOf("Hola"));
122 | //
123 | // System.out.println("===================================");
124 | // System.out.println("Averiguamos si la lista contiene x elemento");
125 | //
126 | // if (lista.contains("Hola")) {
127 | //
128 | // System.out.println("Tiene la palabra hola");
129 | //
130 | // } else {
131 | //
132 | // System.out.println("No la tiene");
133 | // }
134 | //
135 | // System.out.println("===================================");
136 | // System.out.println("Averiguamos si la lista tiene elementos");
137 | //
138 | // if (lista.isEmpty()) {
139 | //
140 | // System.out.println("La lista está vacia");
141 | //
142 | // } else {
143 | //
144 | // System.out.println("La lista no está vacia");
145 | // }
146 | //
147 | // System.out.println("===================================");
148 | // System.out.println("Borramos todos los elementos de la lista");
149 | // lista.clear();
150 |
151 | }
152 |
153 | }
154 |
--------------------------------------------------------------------------------
/Colecciones/src/Mapas/Maps.java:
--------------------------------------------------------------------------------
1 | package Mapas;
2 |
3 | import java.util.HashMap;
4 | import java.util.Iterator;
5 | import java.util.Map;
6 | import java.util.Scanner;
7 | import java.util.TreeMap;
8 |
9 | public class Maps {
10 |
11 | public static void main(String[] args) {
12 |
13 | Scanner leer = new Scanner(System.in).useDelimiter("\n");
14 |
15 | HashMap estudiantes = new HashMap(); // Primero la llave y despues de los valores
16 |
17 | int documento;
18 | String nombre;
19 | String respuesta = "";
20 |
21 | do {
22 | System.out.println("Ingrese el documento del alumno");
23 | documento = leer.nextInt();
24 |
25 | System.out.println("Ingrese el nombre del alumno");
26 | nombre = leer.next();
27 |
28 | estudiantes.put(documento, nombre);
29 |
30 | System.out.println("Quiere ingresar otro alumno ?");
31 | respuesta = leer.next();
32 |
33 | } while (respuesta.equalsIgnoreCase("si"));
34 |
35 |
36 | for (Map.Entry entry : estudiantes.entrySet()) {
37 |
38 | System.out.println("Documento=" + entry.getKey() + ", Nombre=" + entry.getValue());
39 |
40 | }
41 |
42 | // for (Integer dni : estudiantes.keySet()) {
43 | //
44 | // System.out.println("Documento = " + dni);
45 | // }
46 | //
47 | // for (String nombres : estudiantes.values()) {
48 | // System.out.println("Nombre: " + nombres);
49 | // }
50 |
51 | // Iterator> iterator = estudiantes.entrySet().iterator();
52 | //
53 | // System.out.println("Que estudiante quiere eliminar ? ");
54 | // int dni = leer.nextInt();
55 | //
56 | // while (iterator.hasNext()) {
57 | //
58 | // Map.Entry entry = iterator.next();
59 | //
60 | // if (entry.getKey() == dni) {
61 | // iterator.remove();
62 | // }
63 | // }
64 |
65 | System.out.println("Que estudiante quiere eliminar ? ");
66 | int dniABorrar = leer.nextInt();
67 |
68 | estudiantes.remove(dniABorrar);
69 |
70 | for (Map.Entry entry : estudiantes.entrySet()) {
71 |
72 | System.out.println("Documento=" + entry.getKey() + ", Nombre=" + entry.getValue());
73 |
74 | }
75 |
76 | TreeMap estudiantesTree = new TreeMap(estudiantes);
77 |
78 | for (Map.Entry entry : estudiantesTree.entrySet()) {
79 |
80 | System.out.println("Documento=" + entry.getKey() + ", Nombre=" + entry.getValue());
81 |
82 | }
83 |
84 | }
85 |
86 | }
87 |
--------------------------------------------------------------------------------
/Colecciones/src/Mapas/Tree.java:
--------------------------------------------------------------------------------
1 | package Mapas;
2 |
3 | import java.util.Map;
4 | import java.util.Scanner;
5 | import java.util.TreeMap;
6 |
7 | public class Tree {
8 |
9 | public static void main(String[] args) {
10 |
11 | Scanner leer = new Scanner(System.in).useDelimiter("\n");
12 | TreeMap estudiantes = new TreeMap();
13 |
14 | int documento;
15 | String nombre;
16 | String respuesta = "";
17 |
18 | do {
19 | System.out.println("Ingrese el documento del alumno");
20 | documento = leer.nextInt();
21 |
22 | System.out.println("Ingrese el nombre del alumno");
23 | nombre = leer.next();
24 |
25 | estudiantes.put(documento, nombre);
26 |
27 | System.out.println("Quiere ingresar otro alumno ?");
28 | respuesta = leer.next();
29 |
30 | } while (respuesta.equalsIgnoreCase("si"));
31 |
32 | for (Map.Entry entry : estudiantes.entrySet()) {
33 |
34 | System.out.println("documento=" + entry.getKey() + ", nombre=" + entry.getValue());
35 |
36 | }
37 |
38 | // for (Integer dni : estudiantes.keySet()) {
39 | // System.out.println("Documento = " + dni);
40 | // }
41 | //
42 | // for (String nombres : estudiantes.values()) {
43 | // System.out.println("Nombre: " + nombres);
44 | // }
45 | estudiantes.replace(documento, "Martin", "Lucas");
46 |
47 | for (Map.Entry entry : estudiantes.entrySet()) {
48 |
49 | System.out.println("documento=" + entry.getKey() + ", nombre=" + entry.getValue());
50 |
51 | }
52 |
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/Colecciones/src/Sets/SetTree.java:
--------------------------------------------------------------------------------
1 | package Sets;
2 |
3 |
4 | import java.util.Collections;
5 | import java.util.Iterator;
6 | import java.util.Scanner;
7 | import java.util.TreeSet;
8 |
9 | public class SetTree {
10 |
11 | public static void main(String[] args) {
12 |
13 | Scanner leer = new Scanner(System.in).useDelimiter("\n");
14 |
15 | TreeSet treeEnteros = new TreeSet();
16 |
17 | int num;
18 | String respuesta = "";
19 |
20 | do {
21 | System.out.println("Ingrese un numero");
22 | num = leer.nextInt();
23 |
24 | treeEnteros.add(num);
25 |
26 | System.out.println("Quiere ingresar otro numero ?");
27 | respuesta = leer.next();
28 |
29 | } while (respuesta.equalsIgnoreCase("si"));
30 |
31 | System.out.println("===================================");
32 | System.out.println("Mostramos el treeSet con un forEach");
33 |
34 | for (Integer numero : treeEnteros) {
35 |
36 | System.out.println(numero);
37 |
38 | }
39 |
40 | System.out.println("===================================");
41 | System.out.println("Recorremos la TreeSet con un iterator");
42 |
43 | Iterator it = treeEnteros.iterator();
44 |
45 | while (it.hasNext()) {
46 |
47 | System.out.println(it.next());
48 |
49 | }
50 |
51 | System.out.println("===================================");
52 | System.out.println("Usamos el iterator para remover un elemento porque con el for each falla");
53 |
54 | Iterator it2 = treeEnteros.iterator();
55 |
56 | while (it2.hasNext()) {
57 |
58 | if (it2.next().equals(3)) { // Borramos si está el numero 3
59 |
60 | it2.remove();
61 |
62 | }
63 | }
64 |
65 | System.out.println("===================================");
66 | System.out.println("Mostramos el TreeSet sin el elemento borrado");
67 |
68 | for (Integer numero : treeEnteros) {
69 |
70 | System.out.println(numero);
71 |
72 | }
73 |
74 | System.out.println("===================================");
75 | System.out.println("La TreeSet es de tamaño: " + treeEnteros.size());
76 |
77 | System.out.println("===================================");
78 | System.out.println("Averiguamos si el TreeSet contiene x elemento");
79 |
80 | if (treeEnteros.contains(3)) {
81 |
82 | System.out.println("Tiene el numero 3");
83 |
84 | } else {
85 |
86 | System.out.println("No lo tiene");
87 | }
88 |
89 | System.out.println("===================================");
90 | System.out.println("Averiguamos si el TreeSet tiene elementos");
91 |
92 | if (treeEnteros.isEmpty()) {
93 |
94 | System.out.println("El TreeSet está vacio");
95 |
96 | } else {
97 |
98 | System.out.println("El TreeSet no está vacio");
99 | }
100 |
101 | System.out.println("===================================");
102 | System.out.println("Borramos todos los elementos de el TreeSet");
103 | treeEnteros.clear();
104 |
105 |
106 |
107 |
108 |
109 | }
110 |
111 | }
112 |
--------------------------------------------------------------------------------
/Colecciones/src/Sets/Sets.java:
--------------------------------------------------------------------------------
1 | package Sets;
2 |
3 | import java.util.ArrayList;
4 | import java.util.Collections;
5 | import java.util.HashSet;
6 | import java.util.Iterator;
7 | import java.util.Scanner;
8 |
9 | public class Sets {
10 |
11 | public static void main(String[] args) {
12 |
13 | Scanner leer = new Scanner(System.in).useDelimiter("\n");
14 |
15 | HashSet hashEnteros = new HashSet();
16 |
17 | int num;
18 | String respuesta = "";
19 |
20 | do {
21 | System.out.println("Ingrese un numero");
22 | num = leer.nextInt();
23 |
24 | hashEnteros.add(num);
25 |
26 | System.out.println("Quiere ingresar otro numero ?");
27 | respuesta = leer.next();
28 |
29 | } while (respuesta.equalsIgnoreCase("si"));
30 |
31 |
32 | System.out.println("===================================");
33 | System.out.println("Recorremos el hash con un for each");
34 |
35 | for (Integer numero : hashEnteros) {
36 |
37 | System.out.println(numero);
38 |
39 | }
40 |
41 | System.out.println("===================================");
42 | System.out.println("Recorremos la hashSet con un iterator");
43 |
44 | Iterator it = hashEnteros.iterator();
45 |
46 | while (it.hasNext()) {
47 |
48 | System.out.println(it.next());
49 |
50 | }
51 |
52 | System.out.println("===================================");
53 | System.out.println("Usamos el iterator para remover un elemento porque con el for each falla");
54 |
55 | Iterator it2 = hashEnteros.iterator();
56 |
57 | while (it2.hasNext()) {
58 |
59 | if (it2.next() == 3) { // Borramos si está el numero 3
60 |
61 | it2.remove();
62 |
63 | }
64 | }
65 |
66 | System.out.println("===================================");
67 | System.out.println("Mostramos el hashSet sin el elemento borrado");
68 |
69 | for (Integer numero : hashEnteros) {
70 |
71 | System.out.println(numero);
72 |
73 | }
74 |
75 | System.out.println("===================================");
76 | System.out.println("La hashSet es de tamaño: " + hashEnteros.size());
77 |
78 | System.out.println("===================================");
79 | System.out.println("Ordenamos el hashSet");
80 |
81 | ArrayList lista = new ArrayList(hashEnteros); // Para ordenar un hashset hay que convertirlo en una lista primero
82 |
83 | Collections.sort(lista);
84 |
85 | System.out.println("===================================");
86 | System.out.println("Mostramos el hashSet ordenado ascendente");
87 |
88 | for (Integer numero : lista) {
89 |
90 | System.out.println(numero);
91 | }
92 |
93 | System.out.println("===================================");
94 | System.out.println("Ordenamos el hashSet");
95 |
96 | ArrayList lista2 = new ArrayList(hashEnteros); // Para ordenar un hashset hay que convertirlo en una lista primero
97 |
98 | Collections.sort(lista2, Collections.reverseOrder());
99 |
100 | System.out.println("===================================");
101 | System.out.println("Mostramos el hashSet ordenado descendente");
102 |
103 | for (Integer numero : lista2) {
104 |
105 | System.out.println(numero);
106 | }
107 |
108 | System.out.println("===================================");
109 | System.out.println("Averiguamos si el hashSet contiene x elemento");
110 |
111 | if (hashEnteros.contains(3)) {
112 |
113 | System.out.println("Tiene el numero 3");
114 |
115 | } else {
116 |
117 | System.out.println("No lo tiene");
118 | }
119 |
120 | System.out.println("===================================");
121 | System.out.println("Averiguamos si el hashSet tiene elementos");
122 |
123 | if (hashEnteros.isEmpty()) {
124 |
125 | System.out.println("El hashSet está vacio");
126 |
127 | } else {
128 |
129 | System.out.println("El hashSet no está vacio");
130 | }
131 |
132 | System.out.println("===================================");
133 | System.out.println("Borramos todos los elementos de el hashSet");
134 | hashEnteros.clear();
135 |
136 | }
137 |
138 | }
139 |
--------------------------------------------------------------------------------
/EjemploArrayList/build.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Builds, tests, and runs the project EjemploArrayList.
12 |
13 |
73 |
74 |
--------------------------------------------------------------------------------
/EjemploArrayList/build/classes/.netbeans_automatic_build:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EggCooperation/Java-Collecciones/e23dd1f49f265a6c7eaa31e9b7c847f72e36d1f2/EjemploArrayList/build/classes/.netbeans_automatic_build
--------------------------------------------------------------------------------
/EjemploArrayList/build/classes/.netbeans_update_resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EggCooperation/Java-Collecciones/e23dd1f49f265a6c7eaa31e9b7c847f72e36d1f2/EjemploArrayList/build/classes/.netbeans_update_resources
--------------------------------------------------------------------------------
/EjemploArrayList/build/classes/entidad/PersonaArrayList.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EggCooperation/Java-Collecciones/e23dd1f49f265a6c7eaa31e9b7c847f72e36d1f2/EjemploArrayList/build/classes/entidad/PersonaArrayList.class
--------------------------------------------------------------------------------
/EjemploArrayList/build/classes/principal/ClaseMainArrayList.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EggCooperation/Java-Collecciones/e23dd1f49f265a6c7eaa31e9b7c847f72e36d1f2/EjemploArrayList/build/classes/principal/ClaseMainArrayList.class
--------------------------------------------------------------------------------
/EjemploArrayList/build/classes/servicios/PersonaServicioArrayList.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EggCooperation/Java-Collecciones/e23dd1f49f265a6c7eaa31e9b7c847f72e36d1f2/EjemploArrayList/build/classes/servicios/PersonaServicioArrayList.class
--------------------------------------------------------------------------------
/EjemploArrayList/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/EjemploArrayList/nbproject/genfiles.properties:
--------------------------------------------------------------------------------
1 | build.xml.data.CRC32=cd851b71
2 | build.xml.script.CRC32=e31ff788
3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48
4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
6 | nbproject/build-impl.xml.data.CRC32=cd851b71
7 | nbproject/build-impl.xml.script.CRC32=bd0d7c65
8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48
9 |
--------------------------------------------------------------------------------
/EjemploArrayList/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\AsteriX\\AppData\\Roaming\\NetBeans\\8.2\\build.properties
3 |
--------------------------------------------------------------------------------
/EjemploArrayList/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/EjemploArrayList/nbproject/project.properties:
--------------------------------------------------------------------------------
1 | annotation.processing.enabled=true
2 | annotation.processing.enabled.in.editor=false
3 | annotation.processing.processor.options=
4 | annotation.processing.processors.list=
5 | annotation.processing.run.all.processors=true
6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
7 | build.classes.dir=${build.dir}/classes
8 | build.classes.excludes=**/*.java,**/*.form
9 | # This directory is removed when the project is cleaned:
10 | build.dir=build
11 | build.generated.dir=${build.dir}/generated
12 | build.generated.sources.dir=${build.dir}/generated-sources
13 | # Only compile against the classpath explicitly listed here:
14 | build.sysclasspath=ignore
15 | build.test.classes.dir=${build.dir}/test/classes
16 | build.test.results.dir=${build.dir}/test/results
17 | # Uncomment to specify the preferred debugger connection transport:
18 | #debug.transport=dt_socket
19 | debug.classpath=\
20 | ${run.classpath}
21 | debug.test.classpath=\
22 | ${run.test.classpath}
23 | # Files in build.classes.dir which should be excluded from distribution jar
24 | dist.archive.excludes=
25 | # This directory is removed when the project is cleaned:
26 | dist.dir=dist
27 | dist.jar=${dist.dir}/EjemploArrayList.jar
28 | dist.javadoc.dir=${dist.dir}/javadoc
29 | excludes=
30 | includes=**
31 | jar.compress=false
32 | javac.classpath=
33 | # Space-separated list of extra javac options
34 | javac.compilerargs=
35 | javac.deprecation=false
36 | javac.external.vm=true
37 | javac.processorpath=\
38 | ${javac.classpath}
39 | javac.source=1.8
40 | javac.target=1.8
41 | javac.test.classpath=\
42 | ${javac.classpath}:\
43 | ${build.classes.dir}
44 | javac.test.processorpath=\
45 | ${javac.test.classpath}
46 | javadoc.additionalparam=
47 | javadoc.author=false
48 | javadoc.encoding=${source.encoding}
49 | javadoc.noindex=false
50 | javadoc.nonavbar=false
51 | javadoc.notree=false
52 | javadoc.private=false
53 | javadoc.splitindex=true
54 | javadoc.use=true
55 | javadoc.version=false
56 | javadoc.windowtitle=
57 | main.class=
58 | manifest.file=manifest.mf
59 | meta.inf.dir=${src.dir}/META-INF
60 | mkdist.disabled=false
61 | platform.active=default_platform
62 | run.classpath=\
63 | ${javac.classpath}:\
64 | ${build.classes.dir}
65 | # Space-separated list of JVM arguments used when running the project.
66 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
67 | # To set system properties for unit tests define test-sys-prop.name=value:
68 | run.jvmargs=
69 | run.test.classpath=\
70 | ${javac.test.classpath}:\
71 | ${build.test.classes.dir}
72 | source.encoding=UTF-8
73 | src.dir=src
74 | test.src.dir=test
75 |
--------------------------------------------------------------------------------
/EjemploArrayList/nbproject/project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.netbeans.modules.java.j2seproject
4 |
5 |
6 | EjemploArrayList
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/EjemploArrayList/src/entidad/PersonaArrayList.java:
--------------------------------------------------------------------------------
1 |
2 | package entidad;
3 |
4 | public class PersonaArrayList {
5 | //DECLARO LOS ATRIBUTOS
6 | private Integer dni;
7 | private String nombre;
8 | private String apellido;
9 |
10 | //DECLARO LOS CONSTRUCTORES NECESARIOS
11 | public PersonaArrayList(Integer dni, String nombre, String apellido) {
12 | this.dni = dni;
13 | this.nombre = nombre;
14 | this.apellido = apellido;
15 | }
16 |
17 | public PersonaArrayList() {
18 | }
19 |
20 | //DECLARO GETTER Y SETTER
21 | public Integer getDni() {
22 | return dni;
23 | }
24 |
25 | public void setDni(Integer dni) {
26 | this.dni = dni;
27 | }
28 |
29 | public String getNombre() {
30 | return nombre;
31 | }
32 |
33 | public void setNombre(String nombre) {
34 | this.nombre = nombre;
35 | }
36 |
37 | public String getApellido() {
38 | return apellido;
39 | }
40 |
41 | public void setApellido(String apellido) {
42 | this.apellido = apellido;
43 | }
44 |
45 | //DEJO DEFINIDO EL METODO PARA IMPRIMIR LOS OBJETOS
46 | @Override
47 | public String toString() {
48 | return "Persona{" + "dni=" + dni + ", nombre=" + nombre + ", apellido=" + apellido + '}';
49 | }
50 |
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/EjemploArrayList/src/principal/ClaseMainArrayList.java:
--------------------------------------------------------------------------------
1 | package principal;
2 |
3 | import java.util.Scanner;
4 | import servicios.PersonaServicioArrayList;
5 |
6 | public class ClaseMainArrayList {
7 |
8 | public static void main(String[] args) {
9 | Scanner leer = new Scanner(System.in).useDelimiter("\n");
10 |
11 | PersonaServicioArrayList nuevaEjecucion = new PersonaServicioArrayList(); // Llamo a mi clase SERVICIO para acceder a los metodos correspondientes
12 |
13 | System.out.println("Cuantas personas va a cargar???");
14 | byte cantidad = leer.nextByte(); // Para que me diga el usuario cuantas quiere crear
15 |
16 | for (int i = 0; i < cantidad; i++) {
17 | nuevaEjecucion.cargarPersonas(); // Invoco al metodo para cargar una persona, utilizo un FOR para crear las q quiera el Sr
18 | }
19 |
20 | nuevaEjecucion.imprimirTodos(); // Invoco al metodo de imprimir
21 | System.out.println("Ingrese el APELLIDO de la que persona desea eliminar de la lista");
22 | String varElegido = leer.next();
23 | varElegido = varElegido.toUpperCase();
24 |
25 | nuevaEjecucion.buscarElimar(varElegido);//LLAMO AL METODO y envio a quien quiero eliminar. "OJO CON ELIMINARME A MI JAJAJ"
26 | // LLAMO AL METODO PARA ORDENAR
27 | nuevaEjecucion.ordenarAaZApellido();
28 | nuevaEjecucion.imprimirTodos(); // Invoco al metodo de imprimir , para ver que se fue.....
29 |
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/EjemploArrayList/src/servicios/PersonaServicioArrayList.java:
--------------------------------------------------------------------------------
1 | package servicios;
2 |
3 | import entidad.PersonaArrayList;
4 | import java.util.ArrayList;
5 | import java.util.Collections;
6 | import java.util.Iterator;
7 | import java.util.Scanner;
8 |
9 | public class PersonaServicioArrayList {
10 |
11 | private ArrayList nuevaLista; // Creo la lista
12 | private Scanner leer; // Creo el Scanner para utilizar en toda mi clase
13 |
14 | //Esta es una muy buena practica
15 | public PersonaServicioArrayList() {
16 | this.nuevaLista = new ArrayList<>(); // Creo el espacio en memoria del LISTA
17 | this.leer = new Scanner(System.in).useDelimiter("\n");// Cuando se invoca la clase, habilita el flujo de datos
18 | }
19 |
20 | //Metodo para que el usuario carague los DATOS de forma manual
21 | public void cargarPersonas() {
22 | System.out.println("Ingrese el nombre");
23 | String nombreIngresado = leer.next();
24 | nombreIngresado = nombreIngresado.toUpperCase();
25 |
26 | System.out.println("Ingrese el apellido");
27 | String apellidoIngresado = leer.next();
28 | apellidoIngresado = apellidoIngresado.toUpperCase();
29 |
30 | System.out.println("Ingrese el DNI");
31 | Integer dniIngresado = leer.nextInt();
32 |
33 | nuevaLista.add(new PersonaArrayList(dniIngresado, nombreIngresado, apellidoIngresado));
34 | }
35 |
36 | public void imprimirTodos() {
37 | // utilizo el FOREACH - ATAJO NETBEANS fore+TAB - Forma rapida de recorrer colecciones
38 | for (PersonaArrayList unitariaPersona : nuevaLista) {
39 | System.out.println(unitariaPersona.toString());
40 | }
41 | }
42 |
43 | public void buscarElimar(String varElegido) {
44 | // Uso el iterador, porque si uso FOREACH da error
45 | Iterator it = nuevaLista.iterator();
46 | while (it.hasNext()) {
47 | if (it.next().getApellido().equals(varElegido)) { // Si se cumple la condicion de encontrar "Ese apellido elegido,lo elimina)
48 | it.remove();
49 | }
50 | }
51 | }
52 |
53 | public void ordenarAaZApellido(){
54 | //Dejo estructura modelo comentada // Para que entiendan que dato reemplazo a cual en este ejemplpo
55 | // Collections.sort(NombreLista,
56 | // (ClaseAtributos objeto1, ClaseAtributos objeto2) -> objeto1.getAtriutoPaComparar().compareTo(objeto2.getAtriutoPaComparar()));
57 |
58 | Collections.sort(nuevaLista,
59 | (PersonaArrayList objeto1, PersonaArrayList objeto2) -> objeto1.getApellido().compareTo(objeto2.getApellido()));
60 |
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/EjemploHashMap/build.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Builds, tests, and runs the project EjemploHashMap.
12 |
13 |
73 |
74 |
--------------------------------------------------------------------------------
/EjemploHashMap/build/classes/.netbeans_automatic_build:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EggCooperation/Java-Collecciones/e23dd1f49f265a6c7eaa31e9b7c847f72e36d1f2/EjemploHashMap/build/classes/.netbeans_automatic_build
--------------------------------------------------------------------------------
/EjemploHashMap/build/classes/.netbeans_update_resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EggCooperation/Java-Collecciones/e23dd1f49f265a6c7eaa31e9b7c847f72e36d1f2/EjemploHashMap/build/classes/.netbeans_update_resources
--------------------------------------------------------------------------------
/EjemploHashMap/build/classes/entidades/PersonaHashMap.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EggCooperation/Java-Collecciones/e23dd1f49f265a6c7eaa31e9b7c847f72e36d1f2/EjemploHashMap/build/classes/entidades/PersonaHashMap.class
--------------------------------------------------------------------------------
/EjemploHashMap/build/classes/principal/ClaseMainHashMap.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EggCooperation/Java-Collecciones/e23dd1f49f265a6c7eaa31e9b7c847f72e36d1f2/EjemploHashMap/build/classes/principal/ClaseMainHashMap.class
--------------------------------------------------------------------------------
/EjemploHashMap/build/classes/servicios/PersonaServicioHashMap.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EggCooperation/Java-Collecciones/e23dd1f49f265a6c7eaa31e9b7c847f72e36d1f2/EjemploHashMap/build/classes/servicios/PersonaServicioHashMap.class
--------------------------------------------------------------------------------
/EjemploHashMap/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/EjemploHashMap/nbproject/genfiles.properties:
--------------------------------------------------------------------------------
1 | build.xml.data.CRC32=d2d624b8
2 | build.xml.script.CRC32=fc271af9
3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48
4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
6 | nbproject/build-impl.xml.data.CRC32=d2d624b8
7 | nbproject/build-impl.xml.script.CRC32=d3945f76
8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48
9 |
--------------------------------------------------------------------------------
/EjemploHashMap/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\AsteriX\\AppData\\Roaming\\NetBeans\\8.2\\build.properties
3 |
--------------------------------------------------------------------------------
/EjemploHashMap/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/EjemploHashMap/nbproject/project.properties:
--------------------------------------------------------------------------------
1 | annotation.processing.enabled=true
2 | annotation.processing.enabled.in.editor=false
3 | annotation.processing.processor.options=
4 | annotation.processing.processors.list=
5 | annotation.processing.run.all.processors=true
6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
7 | build.classes.dir=${build.dir}/classes
8 | build.classes.excludes=**/*.java,**/*.form
9 | # This directory is removed when the project is cleaned:
10 | build.dir=build
11 | build.generated.dir=${build.dir}/generated
12 | build.generated.sources.dir=${build.dir}/generated-sources
13 | # Only compile against the classpath explicitly listed here:
14 | build.sysclasspath=ignore
15 | build.test.classes.dir=${build.dir}/test/classes
16 | build.test.results.dir=${build.dir}/test/results
17 | # Uncomment to specify the preferred debugger connection transport:
18 | #debug.transport=dt_socket
19 | debug.classpath=\
20 | ${run.classpath}
21 | debug.test.classpath=\
22 | ${run.test.classpath}
23 | # Files in build.classes.dir which should be excluded from distribution jar
24 | dist.archive.excludes=
25 | # This directory is removed when the project is cleaned:
26 | dist.dir=dist
27 | dist.jar=${dist.dir}/EjemploHashMap.jar
28 | dist.javadoc.dir=${dist.dir}/javadoc
29 | excludes=
30 | includes=**
31 | jar.compress=false
32 | javac.classpath=
33 | # Space-separated list of extra javac options
34 | javac.compilerargs=
35 | javac.deprecation=false
36 | javac.external.vm=true
37 | javac.processorpath=\
38 | ${javac.classpath}
39 | javac.source=1.8
40 | javac.target=1.8
41 | javac.test.classpath=\
42 | ${javac.classpath}:\
43 | ${build.classes.dir}
44 | javac.test.processorpath=\
45 | ${javac.test.classpath}
46 | javadoc.additionalparam=
47 | javadoc.author=false
48 | javadoc.encoding=${source.encoding}
49 | javadoc.noindex=false
50 | javadoc.nonavbar=false
51 | javadoc.notree=false
52 | javadoc.private=false
53 | javadoc.splitindex=true
54 | javadoc.use=true
55 | javadoc.version=false
56 | javadoc.windowtitle=
57 | main.class=
58 | manifest.file=manifest.mf
59 | meta.inf.dir=${src.dir}/META-INF
60 | mkdist.disabled=false
61 | platform.active=default_platform
62 | run.classpath=\
63 | ${javac.classpath}:\
64 | ${build.classes.dir}
65 | # Space-separated list of JVM arguments used when running the project.
66 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
67 | # To set system properties for unit tests define test-sys-prop.name=value:
68 | run.jvmargs=
69 | run.test.classpath=\
70 | ${javac.test.classpath}:\
71 | ${build.test.classes.dir}
72 | source.encoding=UTF-8
73 | src.dir=src
74 | test.src.dir=test
75 |
--------------------------------------------------------------------------------
/EjemploHashMap/nbproject/project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.netbeans.modules.java.j2seproject
4 |
5 |
6 | EjemploHashMap
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/EjemploHashMap/src/entidades/PersonaHashMap.java:
--------------------------------------------------------------------------------
1 |
2 | package entidades;
3 |
4 |
5 | public class PersonaHashMap {
6 | //DECLARO LOS ATRIBUTOS
7 | private Integer dni;
8 | private String nombre;
9 | private String apellido;
10 |
11 | //DECLARO LOS CONSTRUCTORES NECESARIOS
12 | public PersonaHashMap(Integer dni, String nombre, String apellido) {
13 | this.dni = dni;
14 | this.nombre = nombre;
15 | this.apellido = apellido;
16 | }
17 |
18 | public PersonaHashMap() {
19 | }
20 |
21 | //DECLARO GETTER Y SETTER
22 | public Integer getDni() {
23 | return dni;
24 | }
25 |
26 | public void setDni(Integer dni) {
27 | this.dni = dni;
28 | }
29 |
30 | public String getNombre() {
31 | return nombre;
32 | }
33 |
34 | public void setNombre(String nombre) {
35 | this.nombre = nombre;
36 | }
37 |
38 | public String getApellido() {
39 | return apellido;
40 | }
41 |
42 | public void setApellido(String apellido) {
43 | this.apellido = apellido;
44 | }
45 |
46 | //DEJO DEFINIDO EL METODO PARA IMPRIMIR LOS OBJETOS
47 | @Override
48 | public String toString() {
49 | return "Persona{" + "DNI=" + dni + ", NOMBRE=" + nombre + ", APELLIDO=" + apellido + '}';
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/EjemploHashMap/src/principal/ClaseMainHashMap.java:
--------------------------------------------------------------------------------
1 |
2 | package principal;
3 |
4 | import java.util.Scanner;
5 | import servicios.PersonaServicioHashMap;
6 |
7 |
8 | public class ClaseMainHashMap {
9 |
10 |
11 | public static void main(String[] args) {
12 | Scanner leer = new Scanner(System.in);
13 |
14 | PersonaServicioHashMap nuevaEjecucion = new PersonaServicioHashMap(); // Llamo a mi clase SERVICIO para acceder a los metodos correspondientes
15 |
16 | System.out.println("Cuantas personas va a cargar???");
17 | byte cantidad = leer.nextByte(); // Para que me diga el usuario cuantas quiere crear
18 |
19 | for (int i = 0; i < cantidad; i++) {
20 | nuevaEjecucion.cargarPersonas(); // Invoco al metodo para cargar una persona, utilizo un FOR para crear las q quiera el Sr
21 | }
22 |
23 | nuevaEjecucion.imprimirTodos(); // Invoco al metodo de imprimir
24 | System.out.println("Ingrese el DNI de la que persona desea eliminar de la lista");
25 | Integer varElegido = leer.nextInt();
26 |
27 | nuevaEjecucion.buscarElimar(varElegido);//LLAMO AL METODO y envio a quien quiero eliminar. "OJO CON ELIMINARME A MI JAJAJ"
28 | nuevaEjecucion.imprimirTodos(); // Invoco al metodo de imprimir , para ver que se fue.....
29 |
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/EjemploHashMap/src/servicios/PersonaServicioHashMap.java:
--------------------------------------------------------------------------------
1 |
2 | package servicios;
3 |
4 | import entidades.PersonaHashMap;
5 | import java.util.HashMap;
6 | import java.util.Iterator;
7 | import java.util.Map;
8 | import java.util.Scanner;
9 |
10 |
11 | public class PersonaServicioHashMap {
12 | //Entre <> Primer termino, digo que tipo de dato es la llave, segundo termino tipo de dato que es el OBJETO a guardar
13 | private HashMap nuevoMapa; // Creo EL MAPA
14 | private Scanner leer; // Creo el Scanner para utilizar en toda mi clase
15 |
16 | //Esta es una muy buena practica
17 | public PersonaServicioHashMap() {
18 | this.nuevoMapa = new HashMap<>(); // Creo el espacio en memoria del MAPA
19 | this.leer = new Scanner(System.in).useDelimiter("\n");// Cuando se invoca la clase, habilita el flujo de datos
20 | }
21 |
22 | //Metodo para que el usuario carague los DATOS de forma manual
23 | public void cargarPersonas() {
24 | System.out.println("Ingrese el nombre");
25 | String nombreIngresado = leer.next();
26 | nombreIngresado = nombreIngresado.toUpperCase();
27 |
28 | System.out.println("Ingrese el apellido");
29 | String apellidoIngresado = leer.next();
30 | apellidoIngresado = apellidoIngresado.toUpperCase();
31 |
32 | System.out.println("Ingrese el DNI");
33 | Integer dniIngresado = leer.nextInt();
34 | // Te este modo agrego elementos a un mapa. Observar que el primer termino se corresponde a la KEY
35 | nuevoMapa.put(dniIngresado,new PersonaHashMap(dniIngresado, nombreIngresado, apellidoIngresado));
36 | }
37 |
38 | public void imprimirTodos() {
39 | // entry.getKey trae la llave y entry.getValue trae los valores del mapa, Es decir todos sus atributos
40 | for (Map.Entry entry : nuevoMapa.entrySet()) {
41 | System.out.println("Documento=" + entry.getKey() + ", Datos de la Persona" + entry.getValue());
42 | }
43 | }
44 |
45 |
46 | public void buscarElimar(Integer varElegido) {
47 | nuevoMapa.remove(varElegido);
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/EjemploHashSet/build.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Builds, tests, and runs the project EjemploHashSet.
12 |
13 |
73 |
74 |
--------------------------------------------------------------------------------
/EjemploHashSet/build/classes/.netbeans_automatic_build:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EggCooperation/Java-Collecciones/e23dd1f49f265a6c7eaa31e9b7c847f72e36d1f2/EjemploHashSet/build/classes/.netbeans_automatic_build
--------------------------------------------------------------------------------
/EjemploHashSet/build/classes/.netbeans_update_resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EggCooperation/Java-Collecciones/e23dd1f49f265a6c7eaa31e9b7c847f72e36d1f2/EjemploHashSet/build/classes/.netbeans_update_resources
--------------------------------------------------------------------------------
/EjemploHashSet/build/classes/Servicios/PersonaServicioHashSet.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EggCooperation/Java-Collecciones/e23dd1f49f265a6c7eaa31e9b7c847f72e36d1f2/EjemploHashSet/build/classes/Servicios/PersonaServicioHashSet.class
--------------------------------------------------------------------------------
/EjemploHashSet/build/classes/entidad/Persona.rs:
--------------------------------------------------------------------------------
1 | ejemploHashSet.Persona
2 |
--------------------------------------------------------------------------------
/EjemploHashSet/build/classes/entidad/PersonaHashSet.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EggCooperation/Java-Collecciones/e23dd1f49f265a6c7eaa31e9b7c847f72e36d1f2/EjemploHashSet/build/classes/entidad/PersonaHashSet.class
--------------------------------------------------------------------------------
/EjemploHashSet/build/classes/principal/ClaseMainHashSet.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EggCooperation/Java-Collecciones/e23dd1f49f265a6c7eaa31e9b7c847f72e36d1f2/EjemploHashSet/build/classes/principal/ClaseMainHashSet.class
--------------------------------------------------------------------------------
/EjemploHashSet/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/EjemploHashSet/nbproject/genfiles.properties:
--------------------------------------------------------------------------------
1 | build.xml.data.CRC32=29e9b74c
2 | build.xml.script.CRC32=34831ade
3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48
4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
6 | nbproject/build-impl.xml.data.CRC32=29e9b74c
7 | nbproject/build-impl.xml.script.CRC32=aedae0cf
8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48
9 |
--------------------------------------------------------------------------------
/EjemploHashSet/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\AsteriX\\AppData\\Roaming\\NetBeans\\8.2\\build.properties
3 |
--------------------------------------------------------------------------------
/EjemploHashSet/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/EjemploHashSet/nbproject/project.properties:
--------------------------------------------------------------------------------
1 | annotation.processing.enabled=true
2 | annotation.processing.enabled.in.editor=false
3 | annotation.processing.processor.options=
4 | annotation.processing.processors.list=
5 | annotation.processing.run.all.processors=true
6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
7 | build.classes.dir=${build.dir}/classes
8 | build.classes.excludes=**/*.java,**/*.form
9 | # This directory is removed when the project is cleaned:
10 | build.dir=build
11 | build.generated.dir=${build.dir}/generated
12 | build.generated.sources.dir=${build.dir}/generated-sources
13 | # Only compile against the classpath explicitly listed here:
14 | build.sysclasspath=ignore
15 | build.test.classes.dir=${build.dir}/test/classes
16 | build.test.results.dir=${build.dir}/test/results
17 | # Uncomment to specify the preferred debugger connection transport:
18 | #debug.transport=dt_socket
19 | debug.classpath=\
20 | ${run.classpath}
21 | debug.test.classpath=\
22 | ${run.test.classpath}
23 | # Files in build.classes.dir which should be excluded from distribution jar
24 | dist.archive.excludes=
25 | # This directory is removed when the project is cleaned:
26 | dist.dir=dist
27 | dist.jar=${dist.dir}/EjemploHashSet.jar
28 | dist.javadoc.dir=${dist.dir}/javadoc
29 | excludes=
30 | includes=**
31 | jar.compress=false
32 | javac.classpath=
33 | # Space-separated list of extra javac options
34 | javac.compilerargs=
35 | javac.deprecation=false
36 | javac.external.vm=true
37 | javac.processorpath=\
38 | ${javac.classpath}
39 | javac.source=1.8
40 | javac.target=1.8
41 | javac.test.classpath=\
42 | ${javac.classpath}:\
43 | ${build.classes.dir}
44 | javac.test.processorpath=\
45 | ${javac.test.classpath}
46 | javadoc.additionalparam=
47 | javadoc.author=false
48 | javadoc.encoding=${source.encoding}
49 | javadoc.noindex=false
50 | javadoc.nonavbar=false
51 | javadoc.notree=false
52 | javadoc.private=false
53 | javadoc.splitindex=true
54 | javadoc.use=true
55 | javadoc.version=false
56 | javadoc.windowtitle=
57 | main.class=
58 | manifest.file=manifest.mf
59 | meta.inf.dir=${src.dir}/META-INF
60 | mkdist.disabled=false
61 | platform.active=default_platform
62 | run.classpath=\
63 | ${javac.classpath}:\
64 | ${build.classes.dir}
65 | # Space-separated list of JVM arguments used when running the project.
66 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
67 | # To set system properties for unit tests define test-sys-prop.name=value:
68 | run.jvmargs=
69 | run.test.classpath=\
70 | ${javac.test.classpath}:\
71 | ${build.test.classes.dir}
72 | source.encoding=UTF-8
73 | src.dir=src
74 | test.src.dir=test
75 |
--------------------------------------------------------------------------------
/EjemploHashSet/nbproject/project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.netbeans.modules.java.j2seproject
4 |
5 |
6 | EjemploHashSet
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/EjemploHashSet/src/entidad/PersonaHashSet.java:
--------------------------------------------------------------------------------
1 |
2 | package entidad;
3 |
4 | import java.util.Objects;
5 |
6 |
7 | public class PersonaHashSet {
8 | //DECLARO LOS ATRIBUTOS
9 | private Integer dni;
10 | private String nombre;
11 | private String apellido;
12 |
13 | //DECLARO LOS CONSTRUCTORES NECESARIOS
14 | public PersonaHashSet(Integer dni, String nombre, String apellido) {
15 | this.dni = dni;
16 | this.nombre = nombre;
17 | this.apellido = apellido;
18 | }
19 |
20 | public PersonaHashSet() {
21 | }
22 |
23 | //DECLARO GETTER Y SETTER
24 | public Integer getDni() {
25 | return dni;
26 | }
27 |
28 | public void setDni(Integer dni) {
29 | this.dni = dni;
30 | }
31 |
32 | public String getNombre() {
33 | return nombre;
34 | }
35 |
36 | public void setNombre(String nombre) {
37 | this.nombre = nombre;
38 | }
39 |
40 | public String getApellido() {
41 | return apellido;
42 | }
43 |
44 | public void setApellido(String apellido) {
45 | this.apellido = apellido;
46 | }
47 |
48 | //DEJO DEFINIDO EL METODO PARA IMPRIMIR LOS OBJETOS
49 | @Override
50 | public String toString() {
51 | return "Persona{" + "dni=" + dni + ", nombre=" + nombre + ", apellido=" + apellido + '}';
52 | }
53 |
54 | //AMBOS METODOS TRABAJAN JUNTOS PARA HACER VALIDACIONES CORRECTAS Y EVITAR DUPLICACIONES.
55 | //DEBO DECIDIR BAJO QUE CRITERIO HAGO LA COMPARACION.
56 | @Override // Lo creo para definir que parametro utiliza para no repetir datos, en este casso DNI
57 | public int hashCode() {
58 | int hash = 5;
59 | hash = 17 * hash + Objects.hashCode(this.dni);
60 | return hash;
61 | }
62 |
63 | @Override
64 | public boolean equals(Object obj) {//Lo creo para definir que parametro utiliza para no repetir datos,en este casso DNI
65 | if (this == obj) {
66 | return true;
67 | }
68 | if (obj == null) {
69 | return false;
70 | }
71 | if (getClass() != obj.getClass()) {
72 | return false;
73 | }
74 | final PersonaHashSet other = (PersonaHashSet) obj;
75 | if (!Objects.equals(this.dni, other.dni)) {
76 | return false;
77 | }
78 | return true;
79 | }
80 |
81 |
82 |
83 |
84 |
85 |
86 | }
87 |
--------------------------------------------------------------------------------
/EjemploHashSet/src/principal/ClaseMainHashSet.java:
--------------------------------------------------------------------------------
1 | package principal;
2 |
3 | import java.util.Scanner;
4 | import servicios.PersonaServicioHashSet;
5 |
6 | public class ClaseMainHashSet {
7 |
8 | public static void main(String[] args) {
9 | Scanner leer = new Scanner(System.in);
10 |
11 | PersonaServicioHashSet nuevaEjecucion = new PersonaServicioHashSet(); // Llamo a mi clase SERVICIO para acceder a los metodos correspondientes
12 |
13 | System.out.println("Cuantas personas va a cargar???");
14 | byte cantidad = leer.nextByte(); // Para que me diga el usuario cuantas quiere crear
15 |
16 | for (int i = 0; i < cantidad; i++) {
17 | nuevaEjecucion.cargarPersonas(); // Invoco al metodo para cargar una persona, utilizo un FOR para crear las q quiera el Sr
18 | }
19 |
20 | nuevaEjecucion.imprimirTodos(); // Invoco al metodo de imprimir
21 | System.out.println("Ingrese el APELLIDO de la que persona desea eliminar de la lista");
22 | String varElegido = leer.next();
23 | varElegido = varElegido.toUpperCase();
24 |
25 | nuevaEjecucion.buscarElimar(varElegido);//LLAMO AL METODO y envio a quien quiero eliminar. "OJO CON ELIMINARME A MI JAJAJ"
26 | nuevaEjecucion.imprimirTodos(); // Invoco al metodo de imprimir , para ver que se fue.....
27 |
28 | }
29 |
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/EjemploHashSet/src/servicios/PersonaServicioHashSet.java:
--------------------------------------------------------------------------------
1 |
2 | package servicios;
3 |
4 | import entidad.PersonaHashSet;
5 | import java.util.HashSet;
6 | import java.util.Iterator;
7 | import java.util.Scanner;
8 |
9 |
10 | public class PersonaServicioHashSet {
11 | private HashSet nuevoMapa; // Creo el mapa
12 | private Scanner leer; // Creo el Scanner para utilizar en toda mi clase
13 |
14 | //Esta es una muy buena practica
15 | public PersonaServicioHashSet() {
16 | this.nuevoMapa = new HashSet<>(); // Creo el espacio en memoria del LISTAS
17 | this.leer = new Scanner(System.in).useDelimiter("\n");// Cuando se invoca la clase, habilita el flujo de datos
18 | }
19 |
20 | //Metodo para que el usuario carague los DATOS de forma manual
21 | public void cargarPersonas(){
22 | System.out.println("Ingrese el nombre");
23 | String nombreIngresado = leer.next();
24 | nombreIngresado = nombreIngresado.toUpperCase();
25 |
26 | System.out.println("Ingrese el apellido");
27 | String apellidoIngresado = leer.next();
28 | apellidoIngresado = apellidoIngresado.toUpperCase();
29 |
30 | System.out.println("Ingrese el DNI");
31 | Integer dniIngresado = leer.nextInt();
32 |
33 | nuevoMapa.add(new PersonaHashSet(dniIngresado,nombreIngresado,apellidoIngresado)); //Si no creo mi HasCode en"PersonaHashSet" no encontrara duplicidad porque su parametro es espacio de mmoria
34 | }
35 |
36 | public void imprimirTodos(){
37 | // utilizo el FOREACH - ATAJO NETBEANS fore+TAB - Forma rapida de recorrer colecciones
38 | for (PersonaHashSet unitariaPersona : nuevoMapa) {
39 | System.out.println(unitariaPersona.toString());
40 | }
41 | }
42 |
43 |
44 | public void buscarElimar(String varElegido) {
45 | // Uso el iterador, porque si uso FOREACH da error
46 | Iterator it = nuevoMapa.iterator();
47 | while (it.hasNext()) {
48 | if (it.next().getApellido().equals(varElegido)) { // Si se cumple la condicion de encontrar "Ese apellido elegido,lo elimina)
49 | it.remove();
50 | }
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/ORDENAR medoto SORT(Colecciones).txt:
--------------------------------------------------------------------------------
1 | // ORDEN ASCENDENTE
2 |
3 | Collections.sort(NombreLista,
4 | (ClaseAtributos objeto1, ClaseAtributos objeto2) -> objeto1.getAtriutoPaComparar().compareTo(objeto2.getAtriutoPaComparar()));
5 |
6 |
7 | // ORDEN DESCENDENTE
8 |
9 |
10 | Collections.sort(NombreLista,
11 | (ClaseAtributos objeto1, ClaseAtributos objeto2) -> objeto2.getAtriutoPaComparar).compareTo(objeto1.getAtriutoPaComparar()));
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Java-Collecciones
2 |
--------------------------------------------------------------------------------