Type mismatch: cannot convert from ArrayList<?> to Collection<BlockPair>
HashMap hints= new HashMap();
hints.put(EncodeHintType.CHARACTER_SET, "utf-8");
hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.M);
hints.put(EncodeHintType.MARGIN,2);
try {
BitMatrix bitMatrix =new MultiFormatWriter().encode(content, BarcodeFormat.QR_CODE, width, height);
Path file=new File("D:/MyEclipse/code/img.png").toPath();
MatrixToImageWriter.writeToPath(bitMatrix, format, file);
} catch (Exception e) {
e.printStackTrace();
}
Exception in thread "main" java.lang.Error: Unresolved compilation problems:?
Type mismatch: cannot convert from ArrayList<?> to Collection<BlockPair>
Cannot instantiate the type ArrayList<?>
Syntax error on token "<", ? expected after this token
2017-10-04
你這段代碼是沒有問題的,可以生成二維碼,把你的全部代碼放出來,連導(dǎo)入的包一起。