Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
import java.util.ArrayList; public class Main { public static void main(String[] args) { // Supongamos que socio_deuda y socio_puesto son instancias de tus listas doblemente enlazadas // Listas de ejemplo ArrayList
socio_deuda = new ArrayList<>(); socio_deuda.add("ABANTO ARAUJO SARA"); socio_deuda.add("ABANTO ROMERO MARIA ROSA"); socio_deuda.add("ABREGU PACHECO MARIO"); socio_deuda.add("ACHAHUANCO MANCHEGO VERONICA"); socio_deuda.add("ACHEICA SERRANO VICENTINA"); socio_deuda.add("ACOSTA FAJARDO SALOME ESTHER"); socio_deuda.add("ACOSTA ZEGARRA YANETT"); socio_deuda.add("ACUÑA BALUIS DE ESPINOZA TEODOCIA"); ArrayList
socio_puesto = new ArrayList<>(); socio_puesto.add("C0612B ABANTO ARAUJO SARA"); socio_puesto.add("D0902B ABANTO ROMERO MARIA ROSA"); socio_puesto.add("M0404A ABANTO ROMERO MARIA ROSA"); socio_puesto.add("B0411B ABREGU PACHECO MARIO"); socio_puesto.add("G1512C ACHAHUANCO MANCHEGO VERONICA"); socio_puesto.add("C0909C ACHEICA SERRANO VICENTINA"); socio_puesto.add("K2407C ACOSTA FAJARDO SALOME ESTHER"); socio_puesto.add("D0808C ACOSTA ZEGARRA YANETT"); socio_puesto.add("D1012B ACUÑA BALUIS DE ESPINOZA TEODOCIA"); // Crear un array donde cada elemento será un array de strings para almacenar socio y puestos String[][] arraySociosYPuestos = new String[socio_deuda.size()][]; // Iterar sobre la lista de deudas y encontrar los puestos correspondientes en la lista de puestos for (int i = 0; i < socio_deuda.size(); i++) { String socio = socio_deuda.get(i); ArrayList
puestos = new ArrayList<>(); for (String s : socio_puesto) { if (s.contains(socio)) { puestos.add(s.split("\\s+")[0]); // Obtener solo el código de puesto } } // Convertir los puestos a un array de strings y almacenar en el array principal arraySociosYPuestos[i] = new String[puestos.size() + 1]; arraySociosYPuestos[i][0] = socio; for (int j = 0; j < puestos.size(); j++) { arraySociosYPuestos[i][j + 1] = puestos.get(j); } } // Imprimir el array resultante for (String[] socioYPuestos : arraySociosYPuestos) { for (String data : socioYPuestos) { System.out.print(data + "\t"); } System.out.println(); } } }
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)