小编EJK*_*EJK的帖子

警告避免使用'HashMap'等实现类型; 改为使用界面

我在声纳上收到这个警告:

避免使用像'HashMap'这样的实现类型; 改为使用界面

这是什么意思?

我收到此警告的类如下:

class A {
   private HashMap<String, String> map=new HashMap<String, String>();

   //getters and setters

}
Run Code Online (Sandbox Code Playgroud)

请,我想要适当的解决方案,以避免在声纳上发出警告.

java

5
推荐指数
2
解决办法
1万
查看次数

如何在xml设置中修复无法识别的标签?

我有setting.xml

<settings
        xmlns="http://maven.apache.org/SETTINGS/1.0.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
    <mirrors>
        <mirror>
            <id>Nexus.Codehaus Snapshots</id>
            <name>Nexus Mirror of Codehaus Snapshots</name>
            <url>http://build/nexus/content/repositories/codehaus-snapshots</url>
            <mirrorOf>Codehaus Snapshots</mirrorOf>
        </mirror>
        <mirror>
            <id>Nexus</id>
            <name>Nexus Public Mirror</name>
            <url>http://nexus.other.com/content/groups/public</url>
            <mirrorOf>Nexus</mirrorOf>
        </mirror>
    </mirrors>

    <server>
        <id>TomcatServer</id>
        <username>admin</username>
        <password>password</password>
    </server>

    <profiles>
        <profile>
            <id>quickBuild</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <properties>
                <maven.test.skip>true</maven.test.skip>
                <pmd.skip>true</pmd.skip>
                <checkstyle.skip>true</checkstyle.skip>
                <findbugs.skip>true</findbugs.skip>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <configuration>
                            <source>${java.version}</source>
                            <target>${java.version}</target>
                            <debug>true</debug>
                            <debuglevel>lines,vars,source</debuglevel>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>some</id>
                                <phase>none</phase>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>findbugs-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>some2</id>
                                <phase>none</phase>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-pmd-plugin</artifactId> …
Run Code Online (Sandbox Code Playgroud)

java xml settings maven

5
推荐指数
1
解决办法
2万
查看次数

Google Play服务-SafeParcelable在哪里?

哪些粒度播放服务包含以下类?

com.google.android.gms.common.internal.safeparcel.SafeParcelable

我目前有以下依赖关系,但是在找不到SafeParcelable时出现错误。

  • play-services-base-8.4.0

  • play-services-location-8.4.0

  • play-services-maps-8.4.0

如果很重要,我将Buck用于我的Android项目,并直接从m2repository中包括这些aar。

android google-play-services buck

4
推荐指数
1
解决办法
4478
查看次数

保存 Nougat 上存储的全局设置的 sqlite 数据库在哪里?

在早期版本中,它是settings.dbdata/data/com.android.providers.settings/databases

但这似乎只是早期版本的情况,在牛轧糖中它已经移动了。

sqlite android

3
推荐指数
1
解决办法
2538
查看次数

在false boolean上使用not语句

我总是假设如果声明被声明为假,例如boolean valid = false,则写入!valid将反过来valid变为真.然而,这是一个完全错误的错误观念吗?例如,在下面的代码中;

for (int check=3; check <= primeLimit; check += 2) {
    boolean divisorFound=false;
    for (int div=3; div<=Math.sqrt(check) && !divisorFound; div += 2) {
        if (check%div==0)
            divisorFound=true;
    }
Run Code Online (Sandbox Code Playgroud)

第二个for循环搜索是否divisorFound为false?因为如果暗示除数是假的,那么它不会只是说:

div<=Math.sqrt(check) && divisorFound;
Run Code Online (Sandbox Code Playgroud)

java boolean

0
推荐指数
1
解决办法
86
查看次数

标签 统计

java ×3

android ×2

boolean ×1

buck ×1

google-play-services ×1

maven ×1

settings ×1

sqlite ×1

xml ×1