问答详情
源自:6-2 使用zxing生成二维码

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


提问者:qq_佑赱_03603889 2017-09-26 12:30

个回答

  • qq_等你千年_0
    2017-10-04 22:51:37

    你这段代码是没有问题的,可以生成二维码,把你的全部代码放出来,连导入的包一起。