Code snippets must use the correct language-specific syntax and include all necessary imports to compile properly. When writing examples: 1. Include all required imports for the libraries and data structures used
Code snippets must use the correct language-specific syntax and include all necessary imports to compile properly. When writing examples:
Bad Example (Java file with Kotlin syntax):
import io.appwrite.services.Databases;
Databases databases = new Databases(client);
databases.updateDocuments(
"<DATABASE_ID>",
"<COLLECTION_ID>",
mapOf("a" to "b"), // Wrong: Using Kotlin syntax in Java
listOf() // Wrong: Using Kotlin syntax in Java
);
Good Example (Java file with Java syntax):
import io.appwrite.services.Databases;
import java.util.Map;
import java.util.List;
Databases databases = new Databases(client);
databases.updateDocuments(
"<DATABASE_ID>",
"<COLLECTION_ID>",
Map.of("a", "b"), // Correct: Using Java Map factory
List.of() // Correct: Using Java List factory
);
Proper language-specific syntax improves code readability and ensures examples actually compile and run correctly for developers.
Enter the URL of a public GitHub repository