by Anonymous » 18 Mar 2025, 18:15
Ich versuche herauszufinden, wie man doppelte Klasseninformation aus schulinformation entfernen, wenn die folgenden Bedingungen übereinstimmen:
Code: Select all
classInformation.teacherPercentage
und classInformation.teachInfo.id sind gleich
Code: Select all
classInformation.studentPercentage
and classInformation.studentInfo.id, classInformation.studentInfo.style, classInformation.studentInfo.graduationYear are the same
JSON:
Code: Select all
{
"schoolInfomration": [
{
"classInformation": [
{
"studentPercentage": 50,
"studentInfo": {
"id": 4,
"style": 3,
"graduationYear": 2028
}
},
{
"teacherPercentage": 50,
"teacherInfo": {
"id": "10019",
"name" : "test2"
}
}
]
},
{
"classInformation": [
{
"studentPercentage": 50,
"studentInfo": {
"id": 4,
"style": 3,
"graduationYear": 2028
}
},
{
"teacherPercentage": 50,
"teacherInfo": {
"id": "10019",
"name" : "test1"
}
}
]
},
{
"classInformation": [
{
"studentPercentage": 50,
"studentInfo": {
"id": 4,
"style": 3,
"graduationYear": 2023
}
},
{
"teacherPercentage": 50,
"teacherInfo": {
"id": "10018",
"name": "test3"
}
}
]
}
]
}
< /code>
Ausgabe: < /p>
{
"schoolInfomration": [
{
"classInformation": [
{
"studentPercentage": 50,
"studentInfo": {
"id": 4,
"style": 3,
"graduationYear": 2028
}
},
{
"teacherPercentage": 50,
"teacherInfo": {
"id": "10019",
"name" : "test2"
}
}
]
},
{
"classInformation": [
{
"studentPercentage": 50,
"studentInfo": {
"id": 4,
"style": 3,
"graduationYear": 2023
}
},
{
"teacherPercentage": 50,
"teacherInfo": {
"id": "10018",
"name": "test3"
}
}
]
}
]
}
< /code>
Datenklassen: < /p>
data class Root(
val schoolInfomration: List,
)
data class SchoolInfomration(
val classInformation: List,
)
data class ClassInformation(
val studentPercentage: Long?,
val studentInfo: StudentInfo?,
val teacherPercentage: Long?,
val teacherInfo: TeacherInfo?,
)
data class StudentInfo(
val id: Long,
val style: Long,
val graduationYear: Long,
)
data class TeacherInfo(
val id: String,
val name: String,
)
Ich versuche herauszufinden, wie man doppelte Klasseninformation aus schulinformation entfernen, wenn die folgenden Bedingungen übereinstimmen:
[list]
[*][code]classInformation.teacherPercentage[/code] und classInformation.teachInfo.id sind gleich
[*][code]classInformation.studentPercentage[/code] and classInformation.studentInfo.id, classInformation.studentInfo.style, classInformation.studentInfo.graduationYear are the same
[/list]
JSON:
[code]{
"schoolInfomration": [
{
"classInformation": [
{
"studentPercentage": 50,
"studentInfo": {
"id": 4,
"style": 3,
"graduationYear": 2028
}
},
{
"teacherPercentage": 50,
"teacherInfo": {
"id": "10019",
"name" : "test2"
}
}
]
},
{
"classInformation": [
{
"studentPercentage": 50,
"studentInfo": {
"id": 4,
"style": 3,
"graduationYear": 2028
}
},
{
"teacherPercentage": 50,
"teacherInfo": {
"id": "10019",
"name" : "test1"
}
}
]
},
{
"classInformation": [
{
"studentPercentage": 50,
"studentInfo": {
"id": 4,
"style": 3,
"graduationYear": 2023
}
},
{
"teacherPercentage": 50,
"teacherInfo": {
"id": "10018",
"name": "test3"
}
}
]
}
]
}
< /code>
Ausgabe: < /p>
{
"schoolInfomration": [
{
"classInformation": [
{
"studentPercentage": 50,
"studentInfo": {
"id": 4,
"style": 3,
"graduationYear": 2028
}
},
{
"teacherPercentage": 50,
"teacherInfo": {
"id": "10019",
"name" : "test2"
}
}
]
},
{
"classInformation": [
{
"studentPercentage": 50,
"studentInfo": {
"id": 4,
"style": 3,
"graduationYear": 2023
}
},
{
"teacherPercentage": 50,
"teacherInfo": {
"id": "10018",
"name": "test3"
}
}
]
}
]
}
< /code>
Datenklassen: < /p>
data class Root(
val schoolInfomration: List,
)
data class SchoolInfomration(
val classInformation: List,
)
data class ClassInformation(
val studentPercentage: Long?,
val studentInfo: StudentInfo?,
val teacherPercentage: Long?,
val teacherInfo: TeacherInfo?,
)
data class StudentInfo(
val id: Long,
val style: Long,
val graduationYear: Long,
)
data class TeacherInfo(
val id: String,
val name: String,
)
[/code]